From: Jinjiang Tu <tujinjiang@huawei.com>
To: David Hildenbrand <david@redhat.com>, <akpm@linux-foundation.org>,
<shr@devkernel.io>, <hannes@cmpxchg.org>, <riel@surriel.com>,
<wangkefeng.wang@huawei.com>, <sunnanyong@huawei.com>,
<linux-mm@kvack.org>
Subject: Re: [PATCH] mm/ksm: remove redundant code in ksm_fork
Date: Sun, 7 Apr 2024 07:37:39 +0800 [thread overview]
Message-ID: <2d5e6b12-0010-ef33-e1f0-c300955e5068@huawei.com> (raw)
In-Reply-To: <cddc0d26-5163-462e-bb9e-7fd87aacad37@redhat.com>
在 2024/4/4 23:34, David Hildenbrand 写道:
> On 02.04.24 04:49, Jinjiang Tu wrote:
>> Since commit 3c6f33b7273a ("mm/ksm: support fork/exec for prctl"),
>> when a
>> child process is forked, the MMF_VM_MERGE_ANY flag will be inherited in
>> mm_init(). So, it's unnecessary to set the flag in ksm_fork().
>>
>> Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
>> ---
>> include/linux/ksm.h | 12 ++----------
>> 1 file changed, 2 insertions(+), 10 deletions(-)
>>
>> diff --git a/include/linux/ksm.h b/include/linux/ksm.h
>> index 401348e9f92b..2e61df795803 100644
>> --- a/include/linux/ksm.h
>> +++ b/include/linux/ksm.h
>> @@ -45,16 +45,8 @@ static inline void
>> ksm_might_unmap_zero_page(struct mm_struct *mm, pte_t pte)
>> static inline int ksm_fork(struct mm_struct *mm, struct mm_struct
>> *oldmm)
>> {
>> - int ret;
>> -
>> - if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags)) {
>> - ret = __ksm_enter(mm);
>> - if (ret)
>> - return ret;
>> - }
>> -
>> - if (test_bit(MMF_VM_MERGE_ANY, &oldmm->flags))
>> - set_bit(MMF_VM_MERGE_ANY, &mm->flags);
>> + if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags))
>> + return __ksm_enter(mm);
>> return 0;
>> }
>
> I *think* this is correct. :)
>
> Did you run the new ksm_functional_tests in mm/mm-unstable to make
> sure they still pass? If so
>
> Reviewed-by: David Hildenbrand <david@redhat.com>
Sorry for late reply, I was on holiday.
I have run the new ksm_functional_tests and the testcases still pass.
prev parent reply other threads:[~2024-04-06 23:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 2:49 Jinjiang Tu
2024-04-04 1:45 ` Andrew Morton
[not found] ` <cddc0d26-5163-462e-bb9e-7fd87aacad37@redhat.com>
2024-04-06 23:37 ` Jinjiang Tu [this message]
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=2d5e6b12-0010-ef33-e1f0-c300955e5068@huawei.com \
--to=tujinjiang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=riel@surriel.com \
--cc=shr@devkernel.io \
--cc=sunnanyong@huawei.com \
--cc=wangkefeng.wang@huawei.com \
/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