[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <34d27471-80a4-49f8-b6cb-f2e51518d9ea@airmail.cc>
Date: Mon, 13 Oct 2025 17:09:00 +0000
From: craftfever <craftfever@...mail.cc>
To: david@...hat.com
Cc: akpm@...ux-foundation.org, chengming.zhou@...ux.dev,
craftfever@...ena.io, linux-kernel@...r.kernel.org, linux-mm@...ck.org,
regressions@...ts.linux.dev, xu.xin16@....com.cn
Subject: Re: [Regerssion] [KSM] KSM CPU overhead in 6.16+ kernel compared to
<=6.15 versions ("folio_walk_start" kernel object overhead)
> Looking again, no, that's not the case. We do a cond_resched() after
every page we looked up.
>
> Also, b1d3e9bbccb4 was introduced in v6.12 already. Regarding
folio_walk_start(), also nothing major changed ever since v6.12.
>
> Looking at scan_get_next_rmap_item(). I guess we might hold the mmap
lock for quite a long time (if we're iterating large areas where there
are no suitable pages mapped -- very large sparse areas).
>
> That would explain why we end up calling folio_walk_start() that
frequently.
>
> But nothing really changed in that regard lately in KSM code.
>
> What we probably should be doing, is give up the mmap lock after
scanning a certain size. Or better, switch to per-VMA locks if possible.
>
> Also, looking up each address is highly inefficient if we end up having
> large empty areas. A range-walk function would be much better suited
for that, so we can just jump over holes completely.
>
> But anyhow, nothing seems to have changed ever since 6.15 AFAIKT, so
I'm not really sure what's going on here. Likely it's unrelated to KSM
changes.
>
> -- Cheers
>
> David / dhildenb
>
I have to make a correction, folio_start_walk is present in "perf top"
statistics on 6.12-6.15, it just consumes 0.5-1% of kernel time compared
to 11-14% on 6.16+, where it causes ksmd 100% cpu usage compared <=6.15
kernels. I understand, that something changed in linked function, that
affecting KSM behavior. Maybe, you can reproduce it with same settings,
especially it happens with Chromium apps, there is V8 sandbox with huge
VM size. Maybe, you could reproduce the problem with the same
MemoryKSM=yes in user@...rvice, that sets KSM processing for all user
processes, especially, when Chromium is running. KSM CPU usage really
differs between 6.12-6.15 and 6.16+. Maybe, it's related to your
explanation. Thank you.
Powered by blists - more mailing lists