[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZSMlFMTuD/5B1U/n@dread.disaster.area>
Date: Mon, 9 Oct 2023 08:54:28 +1100
From: Dave Chinner <david@...morbit.com>
To: "Matthew Wilcox (Oracle)" <willy@...radead.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Chandan Babu R <chandan.babu@...cle.com>,
"Darrick J . Wong" <djwong@...nel.org>, linux-xfs@...r.kernel.org,
Mateusz Guzik <mjguzik@...il.com>
Subject: Re: [PATCH v2 1/5] locking: Add rwsem_assert_held() and
rwsem_assert_held_write()
On Sat, Oct 07, 2023 at 09:35:39PM +0100, Matthew Wilcox (Oracle) wrote:
> Modelled after lockdep_assert_held() and lockdep_assert_held_write(),
> but are always active, even when lockdep is disabled. Of course, they
> don't test that _this_ thread is the owner, but it's sufficient to catch
> many bugs and doesn't incur the same performance penalty as lockdep.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
> ---
.....
> @@ -169,6 +189,18 @@ static __always_inline int rwsem_is_contended(struct rw_semaphore *sem)
> * the RT specific variant.
> */
>
> +static inline void rwsem_assert_held(const struct rw_semaphore *sem)
> +{
> + lockdep_assert_held(sem);
> + __rwsem_assert_held(sem);
> +}
if (IS_ENABLED(CONFIG_LOCKDEP))
lockdep_assert_held(sem);
else
__rwsem_assert_held(sem);
-Dave.
--
Dave Chinner
david@...morbit.com
Powered by blists - more mailing lists