[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200406155834.GR20730@hirez.programming.kicks-ass.net>
Date: Mon, 6 Apr 2020 17:58:34 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Michel Lespinasse <walken@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-mm <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
Laurent Dufour <ldufour@...ux.ibm.com>,
Vlastimil Babka <vbabka@...e.cz>,
Matthew Wilcox <willy@...radead.org>,
Liam Howlett <Liam.Howlett@...cle.com>,
Jerome Glisse <jglisse@...hat.com>,
Davidlohr Bueso <dave@...olabs.net>,
David Rientjes <rientjes@...gle.com>,
Hugh Dickins <hughd@...gle.com>, Ying Han <yinghan@...gle.com>,
Jason Gunthorpe <jgg@...pe.ca>,
Markus Elfring <Markus.Elfring@....de>
Subject: Re: [PATCH v3 06/10] mmap locking API: convert nested write lock
sites
On Mon, Apr 06, 2020 at 08:35:03AM -0700, Michel Lespinasse wrote:
> On Wed, Apr 1, 2020 at 6:42 AM Peter Zijlstra <peterz@...radead.org> wrote:
> >
> > On Fri, Mar 27, 2020 at 03:50:58PM -0700, Michel Lespinasse wrote:
> >
> > > @@ -26,6 +31,12 @@ static inline void mmap_write_unlock(struct mm_struct *mm)
> > > up_write(&mm->mmap_sem);
> > > }
> > >
> > > +/* Pairs with mmap_write_lock_nested() */
> > > +static inline void mmap_write_unlock_nested(struct mm_struct *mm)
> > > +{
> > > + up_write(&mm->mmap_sem);
> > > +}
> > > +
> > > static inline void mmap_downgrade_write_lock(struct mm_struct *mm)
> > > {
> > > downgrade_write(&mm->mmap_sem);
> >
> > Why does unlock_nested() make sense ?
>
> I thought it would make things more explicit to match the nested lock
> with the corresponding unlock site; however this information is not
> used at the moment (i.e. the nested unlock is implemented identically
> to the regular unlock).
>
> Having the matching sites explicitly identified may help when
> implementing lock instrumentation, or when changing the lock type
> (another patchset I am working on needs to pass an explicit lock range
> to the nested lock and unlock sites).
>
> I'll admit this is not a super strong argument, and can be deferred to
> when an actual need shows up in the future.
The thing is, lock-acquisition order matters _a_lot_, lock-release order
is irrelevant. ISTR there was a thread about this some 14 years ago, but
please don't ask me to go find it :/
Powered by blists - more mailing lists