back

by ValdikSS·5y ago·view on hn ↗
https://notes.valdikss.org.ru/linux-for-old-pc-from-2007/en/

The patch prevents eviction of file cache from the RAM, which, when using with zram, makes the system very fast when it is swapping. On regular Linux, when the system is low on RAM, file cache is evicted so quickly and is re-read from the (slow) HDD relatively slowly, that's why the software "lags" (it can't reload the code and resources fast enough to stay fully responsive).

However, with this patch file cache stay in RAM until absolutely necessary to evict it. This GREATLY increases system responsiveness. Even on my old PC from 2007 from the article, swapping hundreds of megabytes to zram is almost unnoticeable process with the patch. The software is so responsive like nothing happens.

Without the patch the PC is uncomfortably slow at times. Swapping process is definitely noticeable, the system may become unresponsive for several seconds (even the mouse doesn't move).

The speedup, however, is a bit of side effect of the patch. It was designed to prevent hard thrashing when the system only evicts and reloads data from the disk for indefinite amount of time.

Watch the video in the linked article above. There's also a LiveCD ISO file to try the patch effect without installing the system/the patched kernel.

1 comments
Ok, so zram is the magic "memory grower". That's orthogonal to the kernel patch and not really swapless like in the patch description. One of my low end Linux phones uses zram. The phone is slow under load, but I have not done any analysis what is the bottleneck.

I have smaller eMMC-based laptops with not much RAM (Don't remember whether 1 or 2 GB) Not in heavy use, but I'll bookmark your reply for testing on one of those. It feels pretty wasteful to use 4 or 8 GB for some basic Web browsing these days. Resource efficiency like American cars from the late 1950s...

No-no, le9 is very useful both with swap (physical or zram) and without. With zram it makes swapping process seamless (no lags when swapping), with physical swap on HDD it makes it a bit softer (on regular kernel both swapping and file reloading upon swapping occurs, making the process even more slower; with le9 it's mostly only swapping), and without swap it prevents hard thrashing and freeze of the PC, (additionally) making OOM killer to trigger much earlier than it usually triggers.