linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Oliver Sang <oliver.sang@intel.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: Re: [PATCH] mm/mmap: Clean up validate_mm() calls
Date: Tue, 4 Jul 2023 14:47:52 -0400	[thread overview]
Message-ID: <20230704184752.6lwrytfirr4huu34@revolver> (raw)
In-Reply-To: <CAHk-=wjUp5+tcsHG89ieuwa0wUtSWWBWRt8xOsoZ1nskZbbk-g@mail.gmail.com>

* Linus Torvalds <torvalds@linux-foundation.org> [230704 14:36]:
> On Tue, 4 Jul 2023 at 11:25, Liam R. Howlett <Liam.Howlett@oracle.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


  reply	other threads:[~2023-07-04 18:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-04 18:24 Liam R. Howlett
2023-07-04 18:36 ` Linus Torvalds
2023-07-04 18:47   ` Liam R. Howlett [this message]
2023-07-05 20:46     ` Liam R. Howlett

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=20230704184752.6lwrytfirr4huu34@revolver \
    --to=liam.howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=oliver.sang@intel.com \
    --cc=torvalds@linux-foundation.org \
    --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