[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <50dd030c-95a5-7bd0-bd93-1a5777923669@redhat.com>
Date: Mon, 13 Mar 2023 13:14:45 +0100
From: David Hildenbrand <david@...hat.com>
To: xu xin <xu.xin.sc@...il.com>
Cc: akpm@...ux-foundation.org, imbrenda@...ux.ibm.com,
jiang.xuexin@....com.cn, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, ran.xiaokai@....com.cn, xu.xin16@....com.cn,
yang.yang29@....com.cn
Subject: Re: [PATCH v5 2/6] ksm: support unsharing zero pages placed by KSM
On 11.03.23 06:37, xu xin wrote:
> [sorry to reply so late, on vacation too, and my mailing system has some kind of problem]
>
>> [sorry, was on vacation last week]
>
>>> Why use flags if they both conditions are mutually exclusive?
>>
>> Just to make the return value of break_ksm_pmd_entry() more expressive and
>> understandable. because break_ksm_pmd_entry have three types of returned
>> values (0, 1, 2).
>
>> It adds confusion. Just simplify it please.
>
> So I think it's good to add a enum value of 0 listed here as suggested
> by Claudio Imbrenda.
>
Please keep it simple.
>>
>>> MADV_UNMERGEABLE -> unmerge_ksm_pages() will never unshare the shared
>>> zeropage? I thought the patch description mentions that that is one of
>>> the goals?
>>
>> No, MADV_UNMERGEABLE will trigger KSM to unshare the shared zeropages in the
>> context of "get_next_rmap_item() -> unshare_zero_pages(), but not directly in the
>> context of " madvise()-> unmerge_ksm_pages() ". The reason for this is to avoid
>> increasing long delays of madvise() calling on unsharing zero pages.
>>
>
>> Why do we care and make this case special?
>
> Yeah, the code seems a bit special, but it is a helpless way and best choice, because the
> action of unsharing zero-pages is too complex and CPU consuming because checking whether the
> page we get is actually placed by KSM or not is not a easy thing in the context of
> unmerge_ksm_pages.
>
> In experiment, unsharing zero-pages in the context of unmerge_ksm_pages cause user' madvise()
> spend 5 times the time than the way of the current patch.
Who exactly cares and why?
>
> So let's leave it as it is now. I will add a (short) explanation of when and why the new
> unshare_zero_page flag should be used.
I vote to keep it as simple as possible in the initial version.
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists