]> Gentwo Git Trees - linux/.git/commit
ksm: perform a range-walk in break_ksm
authorPedro Demarchi Gomes <pedrodemargomes@gmail.com>
Wed, 5 Nov 2025 18:49:11 +0000 (15:49 -0300)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 17 Nov 2025 01:28:28 +0000 (17:28 -0800)
commit5d4939fc2258e80e0eda2a8a190c9e4f78f52456
treebfb18b6902a0413beb625a05c442301273bc7355
parent912aa825957f556a29d781c8f4cb4f4dfd938a9d
ksm: perform a range-walk in break_ksm

Make break_ksm() receive an address range and change break_ksm_pmd_entry()
to perform a range-walk and return the address of the first ksm page
found.

This change allows break_ksm() to skip unmapped regions instead of
iterating every page address.  When unmerging large sparse VMAs, this
significantly reduces runtime.

In a benchmark unmerging a 32 TiB sparse virtual address space where only
one page was populated, the runtime dropped from 9 minutes to less then 5
seconds.

Link: https://lkml.kernel.org/r/20251105184912.186329-3-pedrodemargomes@gmail.com
Signed-off-by: Pedro Demarchi Gomes <pedrodemargomes@gmail.com>
Suggested-by: David Hildenbrand (Red Hat) <david@kernel.org>
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/ksm.c