[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230704184752.6lwrytfirr4huu34@revolver>
Date: Tue, 4 Jul 2023 14:47:52 -0400
From: "Liam R. Howlett" <Liam.Howlett@...cle.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Oliver Sang <oliver.sang@...el.com>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>
Subject: Re: [PATCH] mm/mmap: Clean up validate_mm() calls
* Linus Torvalds <torvalds@...ux-foundation.org> [230704 14:36]:
> On Tue, 4 Jul 2023 at 11:25, Liam R. Howlett <Liam.Howlett@...cle.com> wrote:
> >
> > validate_mm() calls are too spread out and duplicated in numerous
> > locations. Also, now that the stack write is done under the write lock,
> > it is not necessary to validate the mm prior to write operations.
>
> So while I applied the fixes directly since I was doing all the
> write-locking stuff (and asked for the locking cleanup), I'm hoping
> these kinds of cleanups will now go back to normal and go through
> Andrew.
>
> I do have a question related to the write locking: now that we should
> always hold the mmap lock for writing when doing any modifications,
> can the "lock_is_held()" assertions be tightened?
>
> Right now it's "any locking", but for actual modification it should
> probably be using
>
> lockdep_is_held_type(mt->ma_external_lock, 1)
>
> but there's just one 'mt_lock_is_held()' function (presumably because
> the internal lock is always just a spinlock that doesn't have the
> reader/writer distinction).
Ah, yes. I was trying to do just that, but ran into an issue and backed
out of fully fixing this portion up until later.
The issue arises with the use of the same external lock for the munmap()
case where I'm using the second tree to track the VMAs. Using the
spinlock causes issues with the potential sleeping within allocations.
So, I'm still working out a way to do what you (and willy) asked here.
Thanks,
Liam
Powered by blists - more mailing lists