From: David Hildenbrand <david@redhat.com>
To: Stefan Roesch <shr@devkernel.io>
Cc: kernel-team@fb.com, linux-mm@kvack.org, riel@surriel.com,
mhocko@suse.com, linux-kselftest@vger.kernel.org,
linux-doc@vger.kernel.org, akpm@linux-foundation.org,
hannes@cmpxchg.org, willy@infradead.org,
Bagas Sanjaya <bagasdotme@gmail.com>
Subject: Re: [PATCH v6 1/3] mm: add new api to enable ksm per process
Date: Thu, 13 Apr 2023 11:46:46 +0200 [thread overview]
Message-ID: <2b8024d7-3526-6710-5ddb-9c0852bc299d@redhat.com> (raw)
In-Reply-To: <qvqwcz48zxed.fsf@devbig1114.prn1.facebook.com>
On 12.04.23 21:55, Stefan Roesch wrote:
>
> David Hildenbrand <david@redhat.com> writes:
>
>> On 12.04.23 20:41, David Hildenbrand wrote:
>>> [...]
>>>> That will work.
>>>>> work? IOW, not exporting ksm_add_mm() and not passing a flag to __ksm_enter() --
>>>>> it would simply set MMF_VM_MERGEABLE ?
>>>>>
>>>>
>>>> ksm_add_mm() is also used in prctl (kernel/sys.c). Do you want to make a
>>>> similar change there?
>>> Yes.
>>>
>>>>>> + *
>>>>>> + * @vma: Pointer to vma
>>>>>> + */
>>>>>> +void ksm_add_vma(struct vm_area_struct *vma)
>>>>>> +{
>>>>>> + struct mm_struct *mm = vma->vm_mm;
>>>>>> +
>>>>>> + if (test_bit(MMF_VM_MERGE_ANY, &mm->flags))
>>>>>> + __ksm_add_vma(vma);
>>>>>> +}
>>>>>> +
>>>>>> +/**
>>>>>> + * ksm_add_vmas - Mark all vma's of a process as mergeable
>>>>>> + *
>>>>>> + * @mm: Pointer to mm
>>>>>> + */
>>>>>> +void ksm_add_vmas(struct mm_struct *mm)
>>>>>
>>>>> I'd suggest calling this
>>>>>
>>>> I guess you forgot your name suggestion?
>>> Yeah, I reconsidered because the first idea I had was not particularly
>>> good. Maybe
>>> ksm_enable_for_all_vmas()
>>> But not so sure. If you think the "add" terminology is a good fit, keep
>>> it like that.
>>> Thanks for bearing with me :)
>>>
>>
>> I briefly played with your patch to see how much it can be simplified.
>> Always enabling ksm (setting MMF_VM_MERGEABLE) before setting
>> MMF_VM_MERGE_ANY might simplify things. ksm_enable_merge_any() [or however it should
>> be called] and ksm_fork() contain the interesting bits.
>>
>>
>> Feel free to incorporate what you consider valuable (uncompiled,
>> untested).
>>
> I added most of it. The only change is that I kept ksm_add_vmas as a
> static function, otherwise I need to define the VMA_ITERATOR at the top
> of the function.
Makes sense. I'll review patch #3 later, so we can hopefully get this
into the 6.4 merge window after letting it rest at least some days in -next.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2023-04-13 9:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230412031648.2206875-1-shr@devkernel.io>
[not found] ` <20230412031648.2206875-2-shr@devkernel.io>
2023-04-12 13:20 ` [PATCH v6 1/3] mm: add new api to enable ksm per process Matthew Wilcox
2023-04-12 16:08 ` Stefan Roesch
2023-04-12 16:29 ` Matthew Wilcox
2023-04-12 15:40 ` David Hildenbrand
2023-04-12 16:44 ` Stefan Roesch
2023-04-12 18:41 ` David Hildenbrand
2023-04-12 19:08 ` David Hildenbrand
2023-04-12 19:55 ` Stefan Roesch
2023-04-13 9:46 ` David Hildenbrand [this message]
[not found] ` <20230412031648.2206875-4-shr@devkernel.io>
2023-04-13 13:07 ` [PATCH v6 3/3] selftests/mm: add new selftests for KSM David Hildenbrand
2023-04-13 13:08 ` David Hildenbrand
2023-04-13 16:32 ` Stefan Roesch
2023-04-13 18:09 ` Stefan Roesch
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=2b8024d7-3526-6710-5ddb-9c0852bc299d@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bagasdotme@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=riel@surriel.com \
--cc=shr@devkernel.io \
--cc=willy@infradead.org \
/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