On 9/19/26 8:24 AM, Kiryl Shutsemau wrote:
From: "Kiryl Shutsemau (Meta)" <[email protected]>

__madvise_collapse() turns THP off before each MADV_COLLAPSE, both to keep
khugepaged out of the range and to prove MADV_COLLAPSE ignores the setting.
It clears the global controls only, which is no longer enough.  A per-order
control overrides them, and -s, which makes the cases fault in folios of
one order, leaves that order's control at "always".  khugepaged then
collapses the very range the case is working on, and the case fails on a
collapse that was interfered with rather than refused.

Clear the per-order controls too.  MADV_COLLAPSE does not consult them:
anon never did, and shmem stopped with "mm: shmem: ignore sysfs configs
for shmem forced collapse".

Fixes: b7f16963efe7 ("mm/khugepaged: run khugepaged for all orders")
Assisted-by: LLM
Signed-off-by: Kiryl Shutsemau (Meta) <[email protected]>
---

LGTM.
Reviewed-by: Baolin Wang <[email protected]>

Reply via email to