Re: [PATCH v3 06/10] mmap locking API: convert nested write lock sites

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx> 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 :/




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux