[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZFqo50Gg3jFB1OEU@moria.home.lan>
Date: Tue, 9 May 2023 16:11:19 -0400
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-bcachefs@...r.kernel.org,
Kent Overstreet <kent.overstreet@...il.com>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>,
Boqun Feng <boqun.feng@...il.com>
Subject: Re: [PATCH 02/32] locking/lockdep: lock_class_is_held()
On Tue, May 09, 2023 at 09:30:39PM +0200, Peter Zijlstra wrote:
> On Tue, May 09, 2023 at 12:56:27PM -0400, Kent Overstreet wrote:
> > From: Kent Overstreet <kent.overstreet@...il.com>
> >
> > This patch adds lock_class_is_held(), which can be used to assert that a
> > particular type of lock is not held.
>
> How is lock_is_held_type() not sufficient? Which is what's used to
> implement lockdep_assert_held*().
I should've looked at that before - it returns a tristate, so it's
closer than I thought, but this is used in contexts where we don't have
a lock or lockdep_map to pass and need to pass the lock_class_key
instead.
e.g, when initializing a btree_trans, or waiting on btree node IO, we
need to assert that no btree node locks are held.
Looking at the code, __lock_is_held() -> match_held_lock() has to care
about a bunch of stuff related to subclasses that doesn't seem relevant
to lock_class_is_held() - lock_class_is_held() is practically no code in
comparison, so I'm inclined to think they should just be separate.
But I'm not the lockdep expert :) Thoughts?
Powered by blists - more mailing lists