[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <921a7a3f-8552-4eb0-880b-9dac822ed256@suse.cz>
Date: Wed, 30 Apr 2025 14:50:27 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Wei Yang <richard.weiyang@...il.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, Jann Horn <jannh@...gle.com>,
"Liam R . Howlett" <Liam.Howlett@...cle.com>,
Suren Baghdasaryan <surenb@...gle.com>, Matthew Wilcox
<willy@...radead.org>, David Hildenbrand <david@...hat.com>,
Pedro Falcato <pfalcato@...e.de>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v2 01/10] mm/mremap: introduce more mergeable mremap
via MREMAP_RELOCATE_ANON
On 4/30/25 02:47, 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?
You're missing the actual question :)
>>+
>>+ /*
>>+ * 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;
>>+}
>
Powered by blists - more mailing lists