[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <75ce1699-2c5a-4aab-acee-cca5c6a1e37c@huaweicloud.com>
Date: Thu, 4 Dec 2025 08:46:24 +0800
From: Chen Ridong <chenridong@...weicloud.com>
To: "David Hildenbrand (Red Hat)" <david@...nel.org>,
akpm@...ux-foundation.org, axelrasmussen@...gle.com, yuanchu@...gle.com,
weixugc@...gle.com, hannes@...xchg.org, mhocko@...nel.org,
zhengqi.arch@...edance.com, shakeel.butt@...ux.dev,
lorenzo.stoakes@...cle.com, yuzhao@...gle.com, jaewon31.kim@...sung.com
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, lujialin4@...wei.com,
chenridong@...wei.com
Subject: Re: [PATCH -next] mm: vmscan: correct nr_requested tracing in
scan_folios
On 2025/12/3 19:33, David Hildenbrand (Red Hat) wrote:
> On 12/3/25 10:40, Chen Ridong wrote:
>> From: Chen Ridong <chenridong@...wei.com>
>>
>> When enabling vmscan tracing, it is observed that nr_requested is always
>> 4096, which is confusing.
>>
>> mm_vmscan_lru_isolate: classzone=3 order=0 nr_requested=4096 ...
>> mm_vmscan_lru_isolate: classzone=3 order=0 nr_requested=4096 ...
>> mm_vmscan_lru_isolate: classzone=3 order=0 nr_requested=4096 ...
>> mm_vmscan_lru_isolate: classzone=3 order=0 nr_requested=4096 ...
>> mm_vmscan_lru_isolate: classzone=3 order=0 nr_requested=4096 ...
>> mm_vmscan_lru_isolate: classzone=3 order=0 nr_requested=4096 ...
>> mm_vmscan_lru_isolate: classzone=3 order=0 nr_requested=4096 ...
>>
>> This is because it prints MAX_LRU_BATCH, which is meaningless as it's a
>> constant. To fix this, modify it to print nr_to_scan as isolate_lru_folios
>> does.
>>
>> Fixes: 8c2214fc9a47 ("mm: multi-gen LRU: reuse some legacy trace events")
>> Signed-off-by: Chen Ridong <chenridong@...wei.com>
>> ---
>> mm/vmscan.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> index fddd168a9737..8cfafd50a7a8 100644
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -4601,7 +4601,7 @@ static int scan_folios(unsigned long nr_to_scan, struct lruvec *lruvec,
>> count_memcg_events(memcg, item, isolated);
>> count_memcg_events(memcg, PGREFILL, sorted);
>> __count_vm_events(PGSCAN_ANON + type, isolated);
>> - trace_mm_vmscan_lru_isolate(sc->reclaim_idx, sc->order, MAX_LRU_BATCH,
>> + trace_mm_vmscan_lru_isolate(sc->reclaim_idx, sc->order, nr_to_scan,
>> scanned, skipped, isolated,
>
> We do that in isolate_lru_folios().
>
> Given that we do
>
> int remaining = min(nr_to_scan, MAX_LRU_BATCH);
>
> and effectively cap it, I wonder if we would want to trace that capped valued instead of MAX_LRU_BATCH.
>
I prefer tracing nr_to_scan, as it reflects the original target number of pages we intended to scan.
Even if nr_to_scan exceeds MAX_LRU_BATCH, we can still deduce that it was effectively capped by
examining the actual scanned, skipped, or isolated counts. However, if we trace min(nr_to_scan,
MAX_LRU_BATCH) instead, we would lose visibility into what the original nr_to_scan value was.
--
Best regards,
Ridong
Powered by blists - more mailing lists