tytydraco / KTweak

A no-nonsense kernel tweak script for Linux and Android systems, backed by evidence.
BSD 2-Clause "Simplified" License
409 stars 79 forks source link

[Question] about the fair swapiness #29

Closed Mathias-Boulay closed 1 year ago

Mathias-Boulay commented 2 years ago

Hello there, I've been looking into the nice script within this repo when something struck me as a bit weird.

The swapiness is set to 100 which as far as I know is the maximum value available. However, the comment state "swap at a fair rate" which seems weird.

I feel like I'm missing a piece of the puzzle here and would appreciate to be enlightened on how this value was chosen 😄

nift4 commented 2 years ago

As far as I understood it: Android doesn't (unless your OEM is dumb) use real swap, but ZRam only, which is swap-in-ram but compressed, and the compression is not expensive in sense of CPU time.

Mathias-Boulay commented 2 years ago

both can be used iirc, it is even called zswap

nift4 commented 2 years ago

Can be used yes, but in practice I only saw xiaomi doing it

Mathias-Boulay commented 2 years ago

Samsung started advertising swap as extended ram too

ghost commented 2 years ago

On my laptop I use either Zram or Zswap (this currently), with a swappiness value of 200 (kernel 5.10+). It's better to swap early and little because that can be done fast, compared to swapping late and swapping a lot.

TenSeventy7 commented 2 years ago

Samsung started advertising swap as extended ram too

Samsung uses ZRAM writeback for their "RAM Plus" (RAM extension) feature.