[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250923080319.28520-1-zhongjinji@honor.com>
Date: Tue, 23 Sep 2025 16:03:19 +0800
From: zhongjinji <zhongjinji@...or.com>
To: <yuanchu@...gle.com>
CC: <Liam.Howlett@...cle.com>, <akpm@...ux-foundation.org>,
<apopple@...dia.com>, <axboe@...nel.dk>, <axelrasmussen@...gle.com>,
<baohua@...nel.org>, <baolin.wang@...ux.alibaba.com>, <byungchul@...com>,
<david@...hat.com>, <gourry@...rry.net>, <hannes@...xchg.org>,
<harry.yoo@...cle.com>, <jackmanb@...gle.com>, <jaewon31.kim@...sung.com>,
<jiahao1@...iang.com>, <johannes.thumshirn@....com>,
<joshua.hahnjy@...il.com>, <kanchana.p.sridhar@...el.com>, <kas@...nel.org>,
<linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-mm@...ck.org>, <linux-trace-kernel@...r.kernel.org>,
<liulei.rjpt@...o.com>, <lorenzo.stoakes@...cle.com>,
<mathieu.desnoyers@...icios.com>, <matthew.brost@...el.com>,
<mhiramat@...nel.org>, <mhocko@...e.com>, <mingo@...nel.org>,
<npache@...hat.com>, <nphamcs@...il.com>, <peterz@...radead.org>,
<pmladek@...e.com>, <rakie.kim@...com>, <rostedt@...dmis.org>,
<rppt@...nel.org>, <shakeel.butt@...ux.dev>, <surenb@...gle.com>,
<usamaarif642@...il.com>, <vbabka@...e.cz>, <weixugc@...gle.com>,
<willy@...radead.org>, <ying.huang@...ux.alibaba.com>,
<yosry.ahmed@...ux.dev>, <yu.c.chen@...el.com>, <yuzhao@...gle.com>,
<zhengqi.arch@...edance.com>, <ziy@...dia.com>
Subject: Re: [RFC PATCH v0] mm/vmscan: Add readahead LRU to improve readahead file page reclamation efficiency
> 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@...o.com>
Powered by blists - more mailing lists