2023-11-15 10:52:42

by David Hildenbrand

[permalink] [raw]
Subject: Re: [PATCH] ksm: delay the check of splitting compound pages

On 15.11.23 04:15, xu wrote:
>>> From: xu xin <[email protected]>
>>>
>>> Background
>>> ==========
>>> When trying to merge two pages, it may fail because the two pages
>>> belongs to the same compound page and split_huge_page fails due to
>>> the incorrect reference to the page. To solve the problem, the commit
>>> 77da2ba0648a4 ("mm/ksm: fix interaction with THP") tries to split the
>>> compound page after try_to_merge_two_pages() fails and put_page in
>>> that case. However it is too early to calculate of the variable 'split' which
>>> indicates whether the two pages belongs to the same compound page.
>>>
>>> What to do
>>> ==========
>>> If try_to_merge_two_pages() succeeds, there is no need to check whether
>>> to splitting compound pages. So we delay the check of splitting compound
>>> pages until try_to_merge_two_pages() fails, which can improve the
>>> processing efficiency of cmp_and_merge_page() a little.
>>>
>>> Signed-off-by: xu xin <[email protected]>
>>> Reviewed-by: Yang Yang <[email protected]>
>>
>> Can we please add a unit test to ksm_functional_tests.c so we actually
>> get it right this time?
>
> Sure. Maybe we can simply refer to the reproducing way Claudio proposes in
> 77da2ba0648a4 ("mm/ksm: fix interaction with THP").

So, was Claudio able to verify that his fix was correct, and how come we
figure out 5 years later that that fix is insufficient?

Could it not have possibly worked, has something else changed in the
meantime, or what's the deal here? Further elaborating on that in the
patch description and adding a proper Fixes: tag will be appreciated ;)

--
Cheers,

David / dhildenb