lkml.org 
[lkml]   [2023]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [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@infradead.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@fromorbit.com

\
 
 \ /
  Last update: 2023-10-08 23:55    [W:0.080 / U:2.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site