Re: RFC [PATCH 1/1] locking/lockdep: Fix nest lock warning on unlock

From: dbasehore .
Date: Wed Dec 12 2018 - 06:43:08 EST

On Wed, Dec 12, 2018 at 1:09 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Tue, Dec 11, 2018 at 06:25:06PM -0800, Derek Basehore wrote:
> > The function __lock_acquire checks that the nest lock is held passed
> > in as an argument. The issue with this is that __lock_acquire is used
> > for internal bookkeeping on lock_release. This produces a false
> > positive lockdep warning on unlock. Since you explicitly don't need to
> > hold the nest lock on unlock, this is an issue.
> Who is triggering this?

I'm writing code right now that triggers this. The goal is to reduce
lock contention in the Common Clk Framework by getting rid of its
global lock. One of the approaches I'm considering is adding a nest
lock with n "subtree" locks. After locking all of the needed subtree
locks, it's important to unlock the nest lock to reduce contention.