Re: [Regerssion] [KSM] KSM CPU overhead in 6.16+ kernel compared to <=6.15 versions ("folio_walk_start" kernel object overhead)

From: David Hildenbrand

Date: Mon Oct 13 2025 - 05:52:45 EST


On 13.10.25 11:22, craftfever@xxxxxxxxx wrote:

Hi,

I've posted about that problem already on bigzilla (#220599), but maintainers asked to post issues on maillist.
The problem with freezes during KSM page scanning with certain processes like Chromium with huge virtual memory size amount was fized in 6.17.1 compared to 6.16.x/6.17, but problem with huge CPU overhead is present there. Compared to Linux <=6.15, where the overhead is much lighter anad there no much CPU consuming during KSM scanning, there is "folio_walk_start" kernel object is present (which I reviewed with "perf top" command) that is not present in versions <=6.15 during KSM work and which is in work starting from Linux 6.16. This method very resource-consuming compared to algorithm used in <=6.15 versions. Is there a kernel parameter to disable it or it needs more optimization?

I doubt hat it has a lot to do with folio_walk_start(), that's just a simple page table walk replacing the previous walk based on follow_page().

So that's why you would suddenly spot it in perf top -- before commit b1d3e9bbccb4 ("mm/ksm: convert scan_get_next_rmap_item() from follow_page() to folio_walk") we would have used follow_page().

Do you see any kernel splats / soft-lockups?

I can see that in commit b1d3e9bbccb4 I removed a cond_resched(). maybe that's why it's a problem in you kernel config.

--
Cheers

David / dhildenb