[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161008140136.GG3142@twins.programming.kicks-ass.net>
Date: Sat, 8 Oct 2016 16:01:36 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Waiman Long <waiman.long@....com>,
Jason Low <jason.low2@....com>,
Ding Tianhong <dingtianhong@...wei.com>,
Will Deacon <Will.Deacon@....com>,
Ingo Molnar <mingo@...hat.com>,
Imre Deak <imre.deak@...el.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Davidlohr Bueso <dave@...olabs.net>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Terry Rudd <terry.rudd@....com>,
"Paul E. McKenney" <paulmck@...ibm.com>,
Chris Wilson <chris@...is-wilson.co.uk>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Rob Clark <robdclark@...il.com>
Subject: Re: [PATCH -v4 1/8] locking/drm: Kill mutex trickery
On Sat, Oct 08, 2016 at 01:58:07PM +0200, Thomas Gleixner wrote:
> Hmm. I'm not a great fan of this, because that requires an conditional
> unlock mechanism.
>
> res = trylock_recursive(lock);
> if (res == FAILED)
> goto out;
> .....
>
> if (res == SUCCESS)
> unlock(lock);
>
> While if you actually keep track of recursion you can do:
>
> if (!trylock_recursive(lock))
> goto out;
>
> ....
>
> unlock_recursive(lock);
>
> or even:
>
> lock_recursive(lock);
>
> unlock_recursive(lock);
>
> That's making lock/trylock and unlock symetric, so its obvious in the
> source what's going on and the recursion tracking allows for better
> debugability.
Hurm,. so I thought that in general we disliked recursive locking
because it quickly turns in to a horrible mess.
Adding such primitives makes it 'easy' to use recursive locking and then
where does it stop?
Powered by blists - more mailing lists