From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Suren Baghdasaryan <surenb@google.com>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Matthew Wilcox <willy@infradead.org>,
"Paul E . McKenney" <paulmck@kernel.org>,
SeongJae Park <sj@kernel.org>,
Shakeel Butt <shakeel.butt@linux.dev>,
David Hildenbrand <david@redhat.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v2 1/2] mm: move mmap/vma locking logic into specific files
Date: Wed, 16 Apr 2025 15:42:35 +0100 [thread overview]
Message-ID: <1b52ea23-0101-47cd-b49c-01a27316a54a@lucifer.local> (raw)
In-Reply-To: <4782b071-6008-4fd1-b762-65a575dc333a@suse.cz>
On Wed, Apr 16, 2025 at 04:39:50PM +0200, Vlastimil Babka wrote:
> On 4/16/25 12:38, Lorenzo Stoakes wrote:
> > Currently the VMA and mmap locking logic is entangled in two of the most
> > overwrought files in mm - include/linux/mm.h and mm/memory.c. Separate this
> > logic out so we can more easily make changes and create an appropriate
> > MAINTAINERS entry that spans only the logic relating to locking.
> >
> > This should have no functional change. Care is taken to avoid dependency
> > loops, we must regrettably keep release_fault_lock() and
> > assert_fault_locked() in mm.h as a result due to the dependence on the
> > vm_fault type.
> >
> > Additionally we must declare rcuwait_wake_up() manually to avoid a
> > dependency cycle on linux/rcuwait.h.
> >
> > Additionally move the nommu implementatino of lock_mm_and_find_vma() to
> > mmap_lock.c so everything lock-related is in one place.
> >
> > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> > Reviewed-by: Suren Baghdasaryan <surenb@google.com>
>
> Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Thanks!
>
> > diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c
> > index e7dbaf96aa17..5f725cc67334 100644
> > --- a/mm/mmap_lock.c
> > +++ b/mm/mmap_lock.c
> > @@ -42,3 +42,276 @@ void __mmap_lock_do_trace_released(struct mm_struct *mm, bool write)
> > }
> > EXPORT_SYMBOL(__mmap_lock_do_trace_released);
> > #endif /* CONFIG_TRACING */
> > +
> > +#ifdef CONFIG_MMU
> > +#ifdef CONFIG_PER_VMA_LOCK
>
> CONFIG_MMU is implied by CONFIG_PER_VMA_LOCK so you could move the first
> #ifdef later to make only #ifdef CONFIG_LOCK_MM_AND_FIND_VMA nested in it.
> But doesn't matter that much.
>
Yeah, as I said to Suren, I really like to be super-explicit about this,
nommu is such a painful and horrible thing that I like to really clearly
mark when we are doing a workaround for it rather than have it implicit.
Obviously I take the point, and we often do things implicitly, but I feel
overall it's better to spell it out super clearly here!
next prev parent reply other threads:[~2025-04-16 14:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 10:38 [PATCH v2 0/2] separate out mmap_lock/VMA locking and update MAINTAINERS Lorenzo Stoakes
2025-04-16 10:38 ` [PATCH v2 1/2] mm: move mmap/vma locking logic into specific files Lorenzo Stoakes
2025-04-16 13:07 ` Liam R. Howlett
2025-04-16 14:39 ` Vlastimil Babka
2025-04-16 14:42 ` Lorenzo Stoakes [this message]
2025-04-16 10:38 ` [PATCH v2 2/2] MAINTAINERS: add section for locking of mm's and VMAs Lorenzo Stoakes
2025-04-16 13:08 ` Liam R. Howlett
2025-04-16 14:40 ` Vlastimil Babka
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=1b52ea23-0101-47cd-b49c-01a27316a54a@lucifer.local \
--to=lorenzo.stoakes@oracle.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=paulmck@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=sj@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox