On Mon, Jun 8, 2020 at 4:54 PM Konstantin Kharlamov <hi-angel(a)yandex.ru> wrote:
So, I am testing ZRAM right now (as per your advice in another
thread). All well
so far, however reading this makes me think I gonna stumble upon a point where
ZSRAM will be a better fit.
You see, the idea of ZRAM and ZSWAP is improving low-memory situation. This is
especially relevant for small amount of RAM, like your Raspberry example.
In such situation if you, for example, open a lot of tabs in a browser, you may
easily get to a point where even ZRAM is exhausted. Now, had you additionally a
SWAP device, it would be no problem, the data would simply spill over to SWAP.
Yes, SWAP is slow (well, it is on HDD at least). But consider this: in this
workload , you most likely not gonna touch older of browser tabs for quite some
time, so the slowness won't hurt you.
SD Cards are pretty slow in Pi's. And also they have much more limited
wear endurance than laptop SSDs. So in this use case for sure, memory
based swap only is idea. If it's not enough, then I think I've reached
the physical limits of the configuration. But how to make this more
dynamic and smarter is certainly an area worth exploration, including
the idea of creating swapfiles on demand. But that is beyond the scope
of this feature change.
Now, I love the idea of using either ZRAM or ZSWAP. But to consider
which one of
them do we want, I think we would need to discuss first: do we really want to get
rid of disk swap? Hibernation being discussed somewhere in this thread is another
point. I personally don't like idea of removing disk swap.
It is worth continuing the discussion. But for non-hibernation and
incidental swap, taking up more than 4G of swap seems excessive and
only leads to slow systems that will never OOM until all of the swap
partition is full.