From: zhongjinji <zhongjinji@honor.com>
To: <yuanchu@google.com>
Cc: <Liam.Howlett@oracle.com>, <akpm@linux-foundation.org>,
<apopple@nvidia.com>, <axboe@kernel.dk>,
<axelrasmussen@google.com>, <baohua@kernel.org>,
<baolin.wang@linux.alibaba.com>, <byungchul@sk.com>,
<david@redhat.com>, <gourry@gourry.net>, <hannes@cmpxchg.org>,
<harry.yoo@oracle.com>, <jackmanb@google.com>,
<jaewon31.kim@samsung.com>, <jiahao1@lixiang.com>,
<johannes.thumshirn@wdc.com>, <joshua.hahnjy@gmail.com>,
<kanchana.p.sridhar@intel.com>, <kas@kernel.org>,
<linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-mm@kvack.org>, <linux-trace-kernel@vger.kernel.org>,
<liulei.rjpt@vivo.com>, <lorenzo.stoakes@oracle.com>,
<mathieu.desnoyers@efficios.com>, <matthew.brost@intel.com>,
<mhiramat@kernel.org>, <mhocko@suse.com>, <mingo@kernel.org>,
<npache@redhat.com>, <nphamcs@gmail.com>, <peterz@infradead.org>,
<pmladek@suse.com>, <rakie.kim@sk.com>, <rostedt@goodmis.org>,
<rppt@kernel.org>, <shakeel.butt@linux.dev>, <surenb@google.com>,
<usamaarif642@gmail.com>, <vbabka@suse.cz>, <weixugc@google.com>,
<willy@infradead.org>, <ying.huang@linux.alibaba.com>,
<yosry.ahmed@linux.dev>, <yu.c.chen@intel.com>,
<yuzhao@google.com>, <zhengqi.arch@bytedance.com>,
<ziy@nvidia.com>
Subject: Re: [RFC PATCH v0] mm/vmscan: Add readahead LRU to improve readahead file page reclamation efficiency
Date: Tue, 23 Sep 2025 16:03:19 +0800 [thread overview]
Message-ID: <20250923080319.28520-1-zhongjinji@honor.com> (raw)
In-Reply-To: <CAJj2-QHy3rTSPpE5uyu4gW9dWe1E5Q28P_N-VX2Uo+xBFauxdw@mail.gmail.com>
> 1. Problem Background
> In Android systems, a significant challenge arises during application
> startup when a large number of private application files are read.
> Approximately 90% of these file pages are loaded into memory via readahead.
> However, about 85% of these pre-read pages are reclaimed without ever being
> accessed, which means only around 15% of the pre-read pages are effectively
> utilized. This results in wasted memory, as unaccessed file pages consume
> valuable memory space, leading to memory thrashing and unnecessary I/O
> reads.
>
> 2. Solution Proposal
> Introduce a Readahead LRU to track pages brought in via readahead. During
> memory reclamation, prioritize scanning this LRU to reclaim pages that
> have not been accessed recently. For pages in the Readahead LRU that are
> accessed, move them back to the inactive_file LRU to await subsequent
> reclamation.
>
> 3. Benefits Data
> In tests involving the cold start of 30 applications:
> Memory Reclamation Efficiency: The slowpath process saw a reduction of
> over 30%.
Did you enable MGLRU? If you did, I guess "do not active page" and a separate
LRU would have the same effect, but I didn't find any benefits.
diff --git a/mm/swap.c b/mm/swap.c
index 3632dd061beb..9e87996abbc9 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -504,7 +504,8 @@ void folio_add_lru(struct folio *folio)
/* see the comment in lru_gen_folio_seq() */
if (lru_gen_enabled() && !folio_test_unevictable(folio) &&
- lru_gen_in_fault() && !(current->flags & PF_MEMALLOC))
+ lru_gen_in_fault() && !(current->flags & PF_MEMALLOC) &&
+ !folio_test_readahead_lru(folio))
folio_set_active(folio);
folio_batch_add_and_move(folio, lru_add, false);
> 4. Current Issues
> The refault metric for file pages has significantly degraded, increasing
> by about 100%. This is primarily because pages are reclaimed too quickly,
> without sufficient aging.
>
> 5. Next Steps
> When calculating reclamation propensity, adjust the intensity of
> reclamation from the Readahead LRU. This ensures aging and reclamation
> efficiency while allowing adequate aging time.
>
> Signed-off-by: Lei Liu <liulei.rjpt@vivo.com>
prev parent reply other threads:[~2025-09-23 8:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-16 7:22 Lei Liu
2025-09-16 16:33 ` Yuanchu Xie
2025-09-17 9:45 ` Lei Liu
2025-09-23 8:03 ` zhongjinji [this message]
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=20250923080319.28520-1-zhongjinji@honor.com \
--to=zhongjinji@honor.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=axboe@kernel.dk \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=byungchul@sk.com \
--cc=david@redhat.com \
--cc=gourry@gourry.net \
--cc=hannes@cmpxchg.org \
--cc=harry.yoo@oracle.com \
--cc=jackmanb@google.com \
--cc=jaewon31.kim@samsung.com \
--cc=jiahao1@lixiang.com \
--cc=johannes.thumshirn@wdc.com \
--cc=joshua.hahnjy@gmail.com \
--cc=kanchana.p.sridhar@intel.com \
--cc=kas@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=liulei.rjpt@vivo.com \
--cc=lorenzo.stoakes@oracle.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=matthew.brost@intel.com \
--cc=mhiramat@kernel.org \
--cc=mhocko@suse.com \
--cc=mingo@kernel.org \
--cc=npache@redhat.com \
--cc=nphamcs@gmail.com \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=rakie.kim@sk.com \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=usamaarif642@gmail.com \
--cc=vbabka@suse.cz \
--cc=weixugc@google.com \
--cc=willy@infradead.org \
--cc=ying.huang@linux.alibaba.com \
--cc=yosry.ahmed@linux.dev \
--cc=yu.c.chen@intel.com \
--cc=yuanchu@google.com \
--cc=yuzhao@google.com \
--cc=zhengqi.arch@bytedance.com \
--cc=ziy@nvidia.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