Re: [PATCH] mm/vmscan: add sysctl knobs for protecting the working set

From: Barry Song
Date: Fri Feb 11 2022 - 19:02:16 EST


On Tue, Jan 25, 2022 at 9:19 PM ValdikSS <iam@xxxxxxxxxxxxxxx> wrote:
>
> On 13.12.2021 11:38, Barry Song wrote:
> > On Tue, Dec 7, 2021 at 5:47 AM ValdikSS <iam@xxxxxxxxxxxxxxx> wrote:
> >>
> >> This patchset is surprisingly effective and very useful for low-end PC
> >> with slow HDD, single-board ARM boards with slow storage, cheap Android
> >> smartphones with limited amount of memory. It almost completely prevents
> >> thrashing condition and aids in fast OOM killer invocation.
> >>
> >
> > Can you please post your hardware information like what is the cpu, how much
> > memory you have and also post your sysctl knobs, like how do you set
> > vm.anon_min_kbytes, vm.clean_low_kbytes and vm.clean_min_kbytes?
>
> I have a typical office computer of year 2007:
>
> * Motherboard: Gigabyte GA-945GCM-S2L (early LGA775 socket, GMA950
> integrated graphics, September 2007)
> * 2 core 64 bit CPU: Intel® Core™2 Duo E4600 (2 cores, 2.4 GHz, late 2007)
> * 2 GB of RAM (DDR2 667 MHz, single module)
> * Very old and slow 160 GB Hard Disk: Samsung HD161HJ (SATA II, June 2007):
> * No discrete graphics card
>
> I used vm.clean_low_kbytes=384000 (384 MB) to keep most of file cache in
> memory, because the HDD is slow and every data re-read leads to
> uncomfortable freezes and slow work.
>
> More information, including the video, is here:
> https://notes.valdikss.org.ru/linux-for-old-pc-from-2007/en/

thanks!

>
> >
> >> The similar file-locking patch is used in ChromeOS for nearly 10 years
> >> but not on stock Linux or Android. It would be very beneficial for
> >> lower-performance Android phones, SBCs, old PCs and other devices.
> >>
> >
> > Can you post the link of the similar file-locking patch?
>
> Here's a patch: https://lkml.org/lkml/2010/10/28/289
> Here's more in-depth description: https://lkml.org/lkml/2010/11/1/20

thanks, seems to be quite similar with this patch.

>
> Please also note that another Google developer, Yu Zhao, has also made a
> modern version of this (ChromiumOS) patch called MGLRU, the goal of
> which is quite similar to le9 (the patch we're discussing here), but
> with "more brains":
> https://lore.kernel.org/lkml/20220104202247.2903702-1-yuzhao@xxxxxxxxxx/T/#m8fd2a29bc557d27d1000f837f65b6c930eef9dff
>
> Please take a moment and read the information in the link above. Yu Zhao
> develops this patch for almost two years and knows the issue better than
> me, a casual user.
>

Thanks for all the information you provided. I think I have noticed MGLRU
for a while. Curiously, does MGLRU also resolve your problem of using
"a typical office computer of year 2007" ?

>
> >
> >> With this patch, combined with zram, I'm able to run the following
> >> software on an old office PC from 2007 with __only 2GB of RAM__
> >> simultaneously:
> >>
> >> * Firefox with 37 active tabs (all data in RAM, no tab unloading)
> >> * Discord
> >> * Skype
> >> * LibreOffice with the document opened
> >> * Two PDF files (14 and 47 megabytes in size)
> >>
> >> And the PC doesn't crawl like a snail, even with 2+ GB in zram!
> >> Without the patch, this PC is barely usable.
> >> Please watch the video:
> >> https://notes.valdikss.org.ru/linux-for-old-pc-from-2007/en/
> >>
> >
> > The video was captured before using this patch? what video says
> > "the result of the test computer after the configuration", what does
> > "the configuration" mean?
>
> The video was captured after the patch. Before the patch, it's basically
> not possible to use Firefox only with 20+ tabs because the PC enters
> thrashing condition and reacts so slow that even mouse cursor freezes
> frequently. The PC is absolutely unusable for any decent work without
> the patch, regardless of swappiness, vm.min_free_kbytes or any other
> tunables.
>
> The configuration is this patch with vm.clean_low_kbytes=384000 and 150%
> zram. More information is provided on the website.

thanks!

>
> >
> > Thanks
> > Barry

Thanks
Barry