From: David Stevens <stevensd@google.com>
To: Barry Song <21cnbao@gmail.com>
Cc: Kairui Song <ryncsn@gmail.com>,
David Rientjes <rientjes@google.com>,
axelrasmussen@google.com, linux-mm@kvack.org,
lsf-pc@lists.linux-foundation.org, weixugc@google.com,
yuanchu@google.com
Subject: Re: [LSF/MM/BPF] Improving MGLRU
Date: Thu, 5 Mar 2026 09:13:00 -0800 [thread overview]
Message-ID: <aam5nOyXs1sNdjTe@google.com> (raw)
In-Reply-To: <CAGsJ_4ypfGxp5vbNaOt2i2qDmy9tCJuemDjMjwWr6hSv2RtYVA@mail.gmail.com>
On Tue, Mar 03, 2026 at 12:06:20PM +0800, Barry Song wrote:
> On Mon, Mar 2, 2026 at 7:10 PM Kairui Song <ryncsn@gmail.com> wrote:
> > On Fri, Feb 27, 2026 at 11:30 AM Barry Song <21cnbao@gmail.com> wrote:
> > We have an internal workaround for forces aging, and waits for sync
> > aging if one type of folios are not reclaimable (without the wait, we
> > still hit the MIN_NR_GEN protect again since aging is not finished).
> > And without the MIN_NR_GEN protection we might end up over reclaiming
> > without aging.
>
> I see your point—I did exactly the same thing in Android.
> However, there’s a significant problem. If anon has two
> generations and files have four, they end up sharing
> generations. To age anon, we would also need to move file
> folios between generations; otherwise, the hottest and
> oldest generations would overlap, causing cold/hot
> inversion. Furthermore, in inc_min_seq(), moving folios
> means the oldest generation gets pushed into the second-
> oldest generation:
>
> new_gen = folio_inc_gen(lruvec, folio, false);
> list_move_tail(&folio->lru, &lrugen->folios[new_gen][type][zone]);
>
> This is far from ideal, as it still mixes cold and hot pages
> to some extent. Could we keep anon and file generations
> separate instead? I feel this is a strong requirement and
> likely the first step toward making swappiness work properly.
I did some experiments with splitting anon and file generations on
ChromeOS a bit over a year ago and got fairly positive results. Although
shifting personal and team priorities unfortunately prevented me from
finishing the project. It didn't get to the point where I was confident
enough in it to send it upstream, but I think it's still worthwhile to
mention here.
For a bit of background, due to a combination of low-spec hardware and a
complicated file system structure, many Chromebooks have poor file I/O
performance. We found that a fairly significant contributor to jank was
important threads being blocked on .text faults. We tried adjusting
swappiness but found that MGLRU was unresponsive to such tuning.
Splitting anon and file into seperate generations and then setting a
fairly high swappiness value resulted in meaningful jank reductions,
especially under very high memory pressure. However, there were
regressions to some workloads that I did not get a chance to try to
address.
If anyone is interested in seeing the code, it is here [1] in ChromeOS's
6.1 kernel. I also have a WIP series posted to Android's 6.12 GKI kernel
[2], but it hasn't been merged there. This version fixes some issues in
my original series that were exposed by runing on a very different
system, in particular around memcgs. However, it hasn't been tested as
extensively.
[1] https://chromium.googlesource.com/chromiumos/third_party/kernel/+log/929932351492d01f0aee37a0ac3be8c7bd88f80d
[2] https://android.googlesource.com/kernel/common/+log/49cd20cfb0da2361be064f7fd70b36867065277a
next prev parent reply other threads:[~2026-03-05 17:13 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-19 17:25 [LSF/MM/BPF TOPIC] " Kairui Song
2026-02-20 18:24 ` Johannes Weiner
2026-02-21 6:03 ` Kairui Song
2026-02-26 1:55 ` Kalesh Singh
2026-02-26 3:06 ` Kairui Song
2026-02-26 10:10 ` wangzicheng
2026-02-26 15:54 ` Matthew Wilcox
2026-02-27 4:31 ` [LSF/MM/BPF] " Barry Song
2026-03-02 17:46 ` Gregory Price
2026-03-05 6:27 ` Barry Song
2026-03-05 7:31 ` Gregory Price
2026-02-27 17:55 ` [LSF/MM/BPF TOPIC] " Shakeel Butt
2026-02-27 18:50 ` Gregory Price
2026-03-03 1:31 ` Axel Rasmussen
2026-03-03 13:39 ` Shakeel Butt
2026-03-05 6:46 ` Chen Ridong
2026-03-03 1:30 ` Axel Rasmussen
2026-02-27 3:30 ` [LSF/MM/BPF] " Barry Song
2026-03-02 11:10 ` Kairui Song
2026-03-03 4:06 ` Barry Song
2026-03-05 17:13 ` David Stevens [this message]
2026-02-27 7:11 ` [LSF/MM/BPF TOPIC] " David Rientjes
2026-02-27 10:29 ` Vernon Yang
2026-03-02 12:17 ` Kairui Song
-- strict thread matches above, loose matches on Subject: below --
2026-02-19 17:09 [LSF/MM/BPF] " Kairui Song
2026-02-24 17:19 ` Suren Baghdasaryan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aam5nOyXs1sNdjTe@google.com \
--to=stevensd@google.com \
--cc=21cnbao@gmail.com \
--cc=axelrasmussen@google.com \
--cc=linux-mm@kvack.org \
--cc=lsf-pc@lists.linux-foundation.org \
--cc=rientjes@google.com \
--cc=ryncsn@gmail.com \
--cc=weixugc@google.com \
--cc=yuanchu@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox