From: Wei Yang <richard.weiyang@gmail.com>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Wei Yang <richard.weiyang@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@suse.cz>, Jann Horn <jannh@google.com>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Suren Baghdasaryan <surenb@google.com>,
Matthew Wilcox <willy@infradead.org>,
David Hildenbrand <david@redhat.com>,
Pedro Falcato <pfalcato@suse.de>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 01/10] mm/mremap: introduce more mergeable mremap via MREMAP_RELOCATE_ANON
Date: Wed, 30 Apr 2025 15:41:19 +0000 [thread overview]
Message-ID: <20250430154119.a5ljf5t5tutqzim5@master> (raw)
In-Reply-To: <8c052822-5365-4178-8e06-ecd4f917cf8a@lucifer.local>
On Wed, Apr 30, 2025 at 02:15:24PM +0100, Lorenzo Stoakes wrote:
>On Wed, Apr 30, 2025 at 12:47:03AM +0000, Wei Yang wrote:
>> On Tue, Apr 22, 2025 at 09:09:20AM +0100, Lorenzo Stoakes wrote:
>> [...]
>> >+bool vma_had_uncowed_children(struct vm_area_struct *vma)
>> >+{
>> >+ struct anon_vma *anon_vma = vma ? vma->anon_vma : NULL;
>> >+ bool ret;
>> >+
>> >+ if (!anon_vma)
>> >+ return false;
>> >+
>> >+ /*
>> >+ * If we're mmap locked then there's no way for this count to change, as
>> >+ * any such change would require this lock not be held.
>> >+ */
>> >+ if (rwsem_is_locked(&vma->vm_mm->mmap_lock))
>> >+ return anon_vma->num_children > 1;
>>
>> Hi, Lorenzo
>>
>> May I have a question here?
>
>Just ask the question.
>
Thanks.
My question is the function is expected to return true, if we have forked a
vma from this one, right?
IMO there are cases when it has one forked child and anon_vma->num_children == 1,
which means folios are not exclusively mapped. But the function would return
false.
Or maybe I misunderstand the logic here.
>However, with respect, the last drive-by review you gave was not helpful,
>so I strongly suggest that this is not a great use of your time.
>
>Again, I _strongly_ suggest you focus on bug fixes or the like.
Thanks for your suggestion and patience. I would try to focus on bugs and skip
those subtle things.
>
>Thanks.
>
>>
>> >+
>> >+ /*
>> >+ * Any change that would increase the number of children would be
>> >+ * prevented by a read lock.
>> >+ */
>> >+ anon_vma_lock_read(anon_vma);
>> >+ ret = anon_vma->num_children > 1;
>> >+ anon_vma_unlock_read(anon_vma);
>> >+
>> >+ return ret;
>> >+}
>>
>> --
>> Wei Yang
>> Help you, Help me
--
Wei Yang
Help you, Help me
next prev parent reply other threads:[~2025-04-30 15:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-22 8:09 [RFC PATCH v2 00/10] mm/mremap: introduce more mergeable mremap via MREMAP_RELOCATE_ANON Lorenzo Stoakes
2025-04-22 8:09 ` [RFC PATCH v2 01/10] " Lorenzo Stoakes
2025-04-30 0:47 ` Wei Yang
2025-04-30 12:50 ` Vlastimil Babka
2025-04-30 13:15 ` Lorenzo Stoakes
2025-04-30 15:41 ` Wei Yang [this message]
2025-04-30 16:07 ` Lorenzo Stoakes
2025-05-01 1:18 ` Wei Yang
2025-05-01 9:27 ` Lorenzo Stoakes
2025-05-01 14:35 ` Wei Yang
2025-05-01 14:38 ` Lorenzo Stoakes
2025-05-03 14:29 ` Lorenzo Stoakes
2025-05-03 17:50 ` Lorenzo Stoakes
2025-04-22 8:09 ` [RFC PATCH v2 02/10] mm/mremap: add MREMAP_MUST_RELOCATE_ANON Lorenzo Stoakes
2025-04-22 8:09 ` [RFC PATCH v2 03/10] mm/mremap: add MREMAP[_MUST]_RELOCATE_ANON support for large folios Lorenzo Stoakes
2025-04-22 8:09 ` [RFC PATCH v2 04/10] tools UAPI: Update copy of linux/mman.h from the kernel sources Lorenzo Stoakes
2025-04-22 8:09 ` [RFC PATCH v2 05/10] tools/testing/selftests: add sys_mremap() helper to vm_util.h Lorenzo Stoakes
2025-04-22 8:09 ` [RFC PATCH v2 06/10] tools/testing/selftests: add mremap() cases that merge normally Lorenzo Stoakes
2025-04-22 8:09 ` [RFC PATCH v2 07/10] tools/testing/selftests: add MREMAP_RELOCATE_ANON merge test cases Lorenzo Stoakes
2025-04-22 8:09 ` [RFC PATCH v2 08/10] tools/testing/selftests: expand mremap() tests for MREMAP_RELOCATE_ANON Lorenzo Stoakes
2025-04-22 8:09 ` [RFC PATCH v2 09/10] tools/testing/selftests: have CoW self test use MREMAP_RELOCATE_ANON Lorenzo Stoakes
2025-04-22 8:09 ` [RFC PATCH v2 10/10] tools/testing/selftests: test relocate anon in split huge page test Lorenzo Stoakes
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=20250430154119.a5ljf5t5tutqzim5@master \
--to=richard.weiyang@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=pfalcato@suse.de \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.