From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DAFDC433F5 for ; Sat, 12 Feb 2022 00:02:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 71C8B6B0075; Fri, 11 Feb 2022 19:02:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6CCD06B007B; Fri, 11 Feb 2022 19:02:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 596236B007D; Fri, 11 Feb 2022 19:02:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0156.hostedemail.com [216.40.44.156]) by kanga.kvack.org (Postfix) with ESMTP id 4A64A6B0075 for ; Fri, 11 Feb 2022 19:02:10 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 054A5180E1CFD for ; Sat, 12 Feb 2022 00:02:10 +0000 (UTC) X-FDA: 79132175220.17.275337A Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by imf30.hostedemail.com (Postfix) with ESMTP id 9786480002 for ; Sat, 12 Feb 2022 00:02:09 +0000 (UTC) Received: by mail-ed1-f52.google.com with SMTP id s7so18764483edd.3 for ; Fri, 11 Feb 2022 16:02:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=iF2f0XruZIARgUCyX1U2QPFCT1wqAIfn4C7VPW5cedE=; b=E1OC6PzUXj6YDqImYhhQ+36WQF1RffySieRfuha6Wmp5xzOJg6uwZa1XUrzjqDK3Zw eCAgyvSjSfehOxyq4NtVHsojj55l6mL6bsZzjANizfWmi8TqJhDJV/Abif7c4tr4wERG 2BeUGCpJ9DJdMNft/AqjT8TZyVfEd7DWSlnTCGyl/01cfuGF0QGDdbQllnsIVkhkKmKw vcdRiUQXATKp7+8HQJllK/43T27H3FgQ0ARVqtAD88Etm+rMcqAoOTM/OjtQJi2GRIOf VwezrMPKBVNNAEXeOg8JpqcACcmH3CThHzqHaxFZwbsLObYdCzOAbvWtMp8b5UYX+fnm O+Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=iF2f0XruZIARgUCyX1U2QPFCT1wqAIfn4C7VPW5cedE=; b=KddeLUX5uEj7eTFH+SIujGdczoRlE8cDLdxeQrwrgk6li8tZ0f0xWn12UaTYSM9rIH PUyKIMoBuVcvn0Uph+GytJtbmcXGsBdCv1VYodg2Mxydyynb78zqjtqRfPebRQbuP9WE Fzjkwkf1VDUliV2NpWUqOhANax2/2/ThS6PpIb6DazvQPiAJW36hkJIv7QVp/DT3a5R3 MSeZUZJcVQVPFaB1yBuoGj7wcQJ9+H6oYnrETZEkhdYPQDOoybPSlVagRjsR/O0EWtJs dj1NtvtlmJCv5G+3ZRIofKjqV2RZ0RCqHxmD7VxPRn66QD+Iv625iGnj0FfLZ434Pj2h iTiw== X-Gm-Message-State: AOAM532hmnw7kattvR8TzR0hdNpQDfhQ5B5XdHtzh05n6g/LABIt3Hri Mj2ppYqqJyFL5rqg4ax/J4un1I1PSrc/XIrJQgE= X-Google-Smtp-Source: ABdhPJz2v4mSNsOxWhvTeHK+NOGSRMEI3xsBmgOc+ctDZ7l7mneyTWm3B4nxteOCHtche1PAZzgrntTs4stjCHfAZZo= X-Received: by 2002:a05:6402:23a9:: with SMTP id j41mr4346749eda.179.1644624128237; Fri, 11 Feb 2022 16:02:08 -0800 (PST) MIME-Version: 1.0 References: <20211130201652.2218636d@mail.inbox.lv> <2dc51fc8-f14e-17ed-a8c6-0ec70423bf54@valdikss.org.ru> In-Reply-To: From: Barry Song <21cnbao@gmail.com> Date: Sat, 12 Feb 2022 13:01:54 +1300 Message-ID: Subject: Re: [PATCH] mm/vmscan: add sysctl knobs for protecting the working set To: ValdikSS Cc: Alexey Avramov , Linux-MM , Linux Doc Mailing List , linux-fsdevel@vger.kernel.org, LKML , Jonathan Corbet , Andrew Morton , mcgrof@kernel.org, Kees Cook , Iurii Zaikin , oleksandr@natalenko.name, kernel@xanmod.org, aros@gmx.com, hakavlad@gmail.com, Yu Zhao Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=E1OC6PzU; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.208.52 as permitted sender) smtp.mailfrom=21cnbao@gmail.com X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 9786480002 X-Stat-Signature: xa3ppz9n8ys5eee56zgntaoey7ksnh7o X-HE-Tag: 1644624129-654514 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000028, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jan 25, 2022 at 9:19 PM ValdikSS wrote: > > On 13.12.2021 11:38, Barry Song wrote: > > On Tue, Dec 7, 2021 at 5:47 AM ValdikSS wrote: > >> > >> This patchset is surprisingly effective and very useful for low-end PC > >> with slow HDD, single-board ARM boards with slow storage, cheap Androi= d > >> smartphones with limited amount of memory. It almost completely preven= ts > >> 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=C2=AE Core=E2=84=A22 Duo E4600 (2 cores, 2.4 G= Hz, 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=3D384000 (384 MB) to keep most of file cache i= n > 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@google.com/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=3D384000 and 150= % > zram. More information is provided on the website. thanks! > > > > > Thanks > > Barry Thanks Barry