From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Waiman Long <llong@redhat.com>
Cc: linux-kernel@vger.kernel.org, Boqun Feng <boqun.feng@gmail.com>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Will Deacon <will@kernel.org>
Subject: Re: [PATCH] locking/mutex: Redo __mutex_init()
Date: Wed, 5 Nov 2025 08:57:29 +0100 [thread overview]
Message-ID: <20251105075729.SJ4cL1rz@linutronix.de> (raw)
In-Reply-To: <4207482b-fc63-4db7-ab98-36b31a600173@redhat.com>
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
next prev parent reply other threads:[~2025-11-05 7:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 14:00 [PATCH] locking/mutex: Redo __mutex_init() Sebastian Andrzej Siewior
2025-11-04 16:21 ` Waiman Long
2025-11-05 7:57 ` Sebastian Andrzej Siewior [this message]
2025-11-05 13:49 ` Waiman Long
2025-11-05 13:54 ` Sebastian Andrzej Siewior
2025-11-05 14:23 ` [PATCH v2] " Sebastian Andrzej Siewior
2025-11-05 16:22 ` Waiman Long
2025-11-14 15:33 ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2025-11-28 10:00 ` tip-bot2 for Sebastian Andrzej Siewior
2025-12-01 6:01 ` [tip: locking/core] locking/mutex: Redo __mutex_init() to reduce generated code size tip-bot2 for Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251105075729.SJ4cL1rz@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llong@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox