Re: [PATCH mm-unstable v1 2/3] mm/migrate.c: Prevent folio splitting from interacting with KSM
From: xu.xin16
Date: Wed Jul 15 2026 - 04:54:05 EST
> My v2 follows my RFC alternative approach: skip zeropage remapping if
> the split comes from KSM. It also contains the patch (3) from this
> version, which skips zeropage remapping if the shrinker is disabled.
>
> >
> > I do agree with this. I questioned about if it even makes sense to split THP
> > with KSM in RFC (https://lore.kernel.org/all/20260510114001.600681-1-usama.arif@xxxxxxxxx/)
>
> This is indeed a good question but I don't know the right solution.
>
> Perhaps we can discuss it here.
>
> So far here are the potential solutions:
> a) skip zeropage remapping if the split comes from KSM
> b) skip zeropage remapping completely if the shrinker is disabled
> c) Disable KSM THP splitting completely
> d) add a skip_huge_page sysfs toggle
> e) only scan THPs when memory pressure is present
>
> (a)+(b) would be my V2 which I can send out whenever.
Regarding the issue you currently raised (which breaks the semantics of KSM's pages_to_scan),
I think (a) + (b) is acceptable, and I suggest you go ahead and send it out.
As for options (c), (d), and (e), they are somewhat off-topic, touching on broader discussions
about KSM and THP.
>
> (c) is the nuclear option, but perhaps KSM for THP is rather
> inefficient and pointless
>
> (d) could be used with (a) and (b) and allows more flexibility than (c)
>
> (e) is a more dynamic approach, and could be combined with (b) and (d)
>
> Let me know what you think :)
> -- Nico
>
> >