Re: [PATCH 00/14] mm/ksm: merge-path cleanups and folio conversion

From: David Hildenbrand (Arm)

Date: Wed Sep 16 2026 - 02:38:41 EST


On 9/16/26 00:25, Longlong Xia wrote:
> Thanks for the review. You are right that I did not justify the
> page/folio boundary clearly enough.
>
> Patches 11-13 only avoid converting the target page back to a folio and
> provide no functional or performance benefit by themselves.
>
> I will separate the independent cleanups and drop or rework 11-13 after
> getting guidance from the KSM maintainers. I also found a NULL/bisectability
> issue in v1 patch 12, which I will fix before any follow-up.

In general: once we have a ksm folio (folio_test_ksm()), it can only be a small
folio and we can operate on the folio only.

Until that point, we really need the page, because we might be dealing with a
page in a large folio. Sure, we can carry a folio+page pair to reduce repeated
folio lookups, but be aware that we have to re-lookup the folio and take care of
references whenever we call into something that could end up splitting the
folio. So we have to be a bit careful around that.

--
Cheers,

David