[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251105075729.SJ4cL1rz@linutronix.de>
Date: Wed, 5 Nov 2025 08:57:29 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Waiman Long <llong@...hat.com>
Cc: linux-kernel@...r.kernel.org, Boqun Feng <boqun.feng@...il.com>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Will Deacon <will@...nel.org>
Subject: Re: [PATCH] locking/mutex: Redo __mutex_init()
On 2025-11-04 11:21:27 [-0500], Waiman Long wrote:
> > +#ifdef CONFIG_DEBUG_LOCK_ALLOC
> > +void mutex_init_ld(struct mutex *lock, const char *name, struct lock_class_key *key);
> > +
> > +static inline void __mutex_init(struct mutex *lock, const char *name,
> > + struct lock_class_key *key)
> > +{
> > + mutex_init_ld(lock, name, key);
> > +}
> > +#else
> > +extern void mutex_init_plain(struct mutex *lock);
> > +
> > +static inline void __mutex_init(struct mutex *lock, const char *name,
> > + struct lock_class_key *key)
> > +{
> > + mutex_init_plain(lock);
> > +}
> > +#endif /* !CONFIG_DEBUG_LOCK_ALLOC */
>
> I think it is a good idea to eliminate useless strings in non-lockdep
> kernel. However, the function names are kind of awkward to me. First of all,
> it is hard to associate "ld" with lockdep as ld is also the name of the GNU
> linker. I would prefer to fully spell out as "lockdep". The "_plain" suffix
> also looks odd to me. How about using the original __mutex_init for the
> plain version and __mutex_init_lockdep as the lockdep version which calls
> __mutex_init and use similar naming scheme for the RT versions. What do you
> think?
What about
mutex_init_plain() -> mutex_init_generic()
mutex_init_ld() -> mutex_init_lockdep()
Using __mutex_init() for the basic/ generic init could work but we have
already users 13 users (drivers/ mm/ net/) and the rust bindings are
also attached to it. I would prefer the generic/ lockdep suffix.
If you want __mutex_init() for the generic, regardless, we would first
need to make room and then something like mutex_init_lockdep() could be
the public interface replacing __mutex_init() in its current function.
> Cheers,
> Longman
Sebastian
Powered by blists - more mailing lists