[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260121190144.GK166857@noisy.programming.kicks-ass.net>
Date: Wed, 21 Jan 2026 20:01:44 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Bart Van Assche <bvanassche@....org>
Cc: elver@...gle.com, linux-kernel@...r.kernel.org, bigeasy@...utronix.de,
mingo@...nel.org, tglx@...utronix.de, will@...nel.org,
boqun.feng@...il.com, longman@...hat.com, hch@....de,
rostedt@...dmis.org, llvm@...ts.linux.dev
Subject: Re: [RFC][PATCH 3/4] locking/rtmutex: Add context analysis
On Wed, Jan 21, 2026 at 09:15:53AM -0800, Bart Van Assche wrote:
> On 1/21/26 3:07 AM, Peter Zijlstra wrote:
> > Add compiler context analysis annotations.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> > ---
> > include/linux/mutex.h | 2 +-
> > include/linux/rtmutex.h | 4 ++--
> > kernel/locking/Makefile | 2 ++
> > kernel/locking/mutex.c | 2 --
> > kernel/locking/rtmutex.c | 18 +++++++++++++++++-
> > kernel/locking/rtmutex_api.c | 3 +++
> > kernel/locking/rtmutex_common.h | 22 ++++++++++++++++------
> > kernel/locking/ww_mutex.h | 18 +++++++++++++-----
> > kernel/locking/ww_rt_mutex.c | 1 +
> > 9 files changed, 55 insertions(+), 17 deletions(-)
>
> The patch subject says "rtmutex" but this patch includes a change for
> the header file include/linux/mutex.h. Shouldn't that change be moved
> into the mutex patch?
Clearly I suffered from wandering hunks syndrome while doing these :/
> > --- a/kernel/locking/mutex.c
> > +++ b/kernel/locking/mutex.c
> > @@ -848,7 +848,6 @@ EXPORT_SYMBOL_GPL(mutex_lock_nested);
> > void __sched
> > _mutex_lock_nest_lock(struct mutex *lock, struct lockdep_map *nest)
> > - __acquires(lock)
> > {
> > __mutex_lock(lock, TASK_UNINTERRUPTIBLE, 0, nest, _RET_IP_);
> > __acquire(lock);
>
> Shouldn't the "__acquires()" annotation be moved to the declaration in
> <linux/mutex.h>?
It is, but yeah, this should be in the previous patch.
> > #define MUTEX mutex
> > #define MUTEX_WAITER mutex_waiter
> > +#define MUST_HOLD_WAIT_LOCK __must_hold(&lock->wait_lock)
> > static inline struct mutex_waiter *
> > __ww_waiter_first(struct mutex *lock)
> > @@ -97,9 +98,11 @@ static inline void lockdep_assert_wait_l
> > #define MUTEX rt_mutex
> > #define MUTEX_WAITER rt_mutex_waiter
> > +#define MUST_HOLD_WAIT_LOCK __must_hold(&lock->rtmutex.wait_lock)
>
> Is it really necessary to introduce these two macros? I prefer to see
> the __must_hold() annotations instead of the macro names.
You'd rather see something like:
__must_hold(&lock->WAIT_LOCK)
? Can do I suppose.
Powered by blists - more mailing lists