From: David Hildenbrand <david@redhat.com>
To: xu xin <xu.xin.sc@gmail.com>
Cc: akpm@linux-foundation.org, imbrenda@linux.ibm.com,
jiang.xuexin@zte.com.cn, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, ran.xiaokai@zte.com.cn, xu.xin16@zte.com.cn,
yang.yang29@zte.com.cn
Subject: Re: [PATCH v5 2/6] ksm: support unsharing zero pages placed by KSM
Date: Mon, 13 Mar 2023 13:14:45 +0100 [thread overview]
Message-ID: <50dd030c-95a5-7bd0-bd93-1a5777923669@redhat.com> (raw)
In-Reply-To: <20230311053714.178439-1-xu.xin16@zte.com.cn>
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
next prev parent reply other threads:[~2023-03-13 12:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-11 5:37 xu xin
2023-03-13 12:14 ` David Hildenbrand [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-12-30 1:13 yang.yang29
2023-01-18 14:10 ` David Hildenbrand
2023-02-04 6:18 ` yang.yang29
2023-02-13 12:44 ` David Hildenbrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50dd030c-95a5-7bd0-bd93-1a5777923669@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=imbrenda@linux.ibm.com \
--cc=jiang.xuexin@zte.com.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ran.xiaokai@zte.com.cn \
--cc=xu.xin.sc@gmail.com \
--cc=xu.xin16@zte.com.cn \
--cc=yang.yang29@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox