public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>, linux-kernel@vger.kernel.org
Cc: Jani Nikula <jani.nikula@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Randy Dunlap <rdunlap@infradead.org>,
	Andi Shyti <andi.shyti@kernel.org>, Lee Jones <lee@kernel.org>,
	Arseniy Krasnov <AVKrasnov@sberdevices.ru>,
	Johannes Berg <johannes.berg@intel.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Robert Richter <rrichter@amd.com>, Vinod Koul <vkoul@kernel.org>,
	Hans de Goede <hdegoede@redhat.com>,
	Nikita Kravets <teackot@gmail.com>,
	Jiri Slaby <jirislaby@kernel.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Kent Overstreet <kent.overstreet@linux.dev>,
	Eric Biggers <ebiggers@google.com>,
	Kees Cook <keescook@chromium.org>, Ingo Molnar <mingo@kernel.org>,
	"Steven Rostedt (Google)" <rostedt@goodmis.org>,
	Daniel Bristot de Oliveira <bristot@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Hugh Dickins <hughd@google.com>,
	John Johansen <john.johansen@canonical.com>,
	Eric Snowberg <eric.snowberg@oracle.com>,
	Takashi Iwai <tiwai@suse.de>,
	Takashi Sakamoto <o-takashi@sakamocchi.jp>,
	Mark Brown <broonie@kernel.org>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	David Howells <dhowells@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Sergey Shtylyov <s.shtylyov@omp.ru>,
	Damien Le Moal <dlemoal@kernel.org>,
	Niklas Cassel <cassel@kernel.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Ray Jui <rjui@broadcom.com>,
	Peter De Schrijver <pdeschrijver@nvidia.com>,
	Prashant Gaikwad <pgaikwad@nvidia.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	Karol Herbst <kherbst@redhat.com>, Lyude Paul <lyude@redhat.com>,
	Danilo Krummrich <dakr@redhat.com>,
	Jean Delvare <jdelvare@suse.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Pavel Machek <pavel@ucw.cz>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Miri Korenblit <miriam.rachel.korenblit@intel.com>,
	Kalle Valo <kvalo@kernel.org>,
	Kishon Vijay Abraham I <kishon@kernel.org>,
	Sebastian Reichel <sre@kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Tejun Heo <tj@kernel.org>, Johannes Weiner <hannes@cmpxchg.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Valentin Schneider <vschneid@redhat.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Jason Baron <jbaron@akamai.com>, Paul Moore <paul@paul-moore.com>,
	James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
	Clemens Ladisch <clemens@ladisch.de>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v1 1/1] treewide: Align match_string() with sysfs_match_string()
Date: Tue, 11 Jun 2024 14:38:02 -0700	[thread overview]
Message-ID: <Zmi9bVdd8uNeqkWl@yury-ThinkPad> (raw)
In-Reply-To: <CACRpkdZFPG_YLici-BmYfk9HZ36f4WavCN3JNotkk8cPgCODCg@mail.gmail.com>

On Mon, Jun 10, 2024 at 10:08:00AM +0200, Linus Walleij wrote:
> On Tue, Jun 4, 2024 at 9:46 AM Jani Nikula <jani.nikula@linux.intel.com> wrote:
> 
> [Maybe slightly off-topic, ranty]
> 
> > Why do we think it's a good idea to increase and normalize the use of
> > double-underscore function names across the kernel, like
> > __match_string() in this case? It should mean "reserved for the
> > implementation, not to be called directly".
> >
> > If it's to be used directly, it should be named accordingly, right?
> 
> It's a huge mess. "__" prefix is just so ambiguous I think it just
> shouldn't be used or prolifierated, and it usually breaks Rusty Russells
> API rules times over.
> 
> Consider __set_bit() from <linux/bitops.h>, used all over the place,
> in contrast with set_bit() for example, what does "__" represent in
> this context that makes __set_bit() different from set_bit()?
> 
> It means "non-atomic"...
> 
> How does a random contributor know this?
> 
> Yeah, you guess it. By the token of "everybody knows that".
> (Grep, google, repeat for the number of contributors to the kernel.)
> 
> I was considering to send a script to Torvalds to just change all
> this to set_bit_nonatomic() (etc) but was hesitating because that
> makes the name unambiguous but long. I think I stayed off it
> because changing stuff like that all over the place creates churn
> and churn is bad.

Hi Linus,

I think about renaming set_bit() stuff for atomicity at least twice
a year. But it would be over 15000 renames for set and clear_bit only:

yury:linux$ git grep -w -E "set_bit|clear_bit"|wc -l
12972
yury:linux$ git grep -w -E "__set_bit|__clear_bit"|wc -l
2914

Anyways, if someone is brave enough to do that... The main problem is
that set_bit() is heavily abused because people don't bother putting
the '__' thing, which leads to using atomic helpers where non-atomic
versions are enough. 

So the right path for renaming would be:

s/set_bit/atomic_set_bit
s/__set_bit/nonatomic_set_bit
/* Wait for a full release cycle or two to let people get used, then */
#define set_bit nonatomic_set_bit

Thanks,
Yury

PS. Had to drop all maillists except for LKML and some random victims
because my gmail account doesn't allow more that 100 recipients. If
you guys know how to increase the limit, please advise.

  reply	other threads:[~2024-06-11 21:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-02 15:57 [PATCH v1 1/1] treewide: Align match_string() with sysfs_match_string() Andy Shevchenko
2024-06-03 22:00 ` Bjorn Helgaas
2024-06-03 22:06 ` Linus Torvalds
2024-06-04  1:29 ` Damien Le Moal
2024-06-04  1:37 ` Zhihao Cheng
2024-06-04  6:42 ` Daniel Bristot de Oliveira
2024-06-04  7:25 ` Heiko Stübner
2024-06-04  7:45 ` Jani Nikula
2024-06-04 15:52   ` Steven Rostedt
2024-06-04 16:36     ` Andy Shevchenko
2024-06-10  8:08   ` Linus Walleij
2024-06-11 21:38     ` Yury Norov [this message]
2024-06-11 23:48       ` Linus Torvalds
2024-06-04  7:55 ` Vinod Koul
2024-06-04  7:55 ` Wolfram Sang
2024-06-04  8:23 ` Sakari Ailus
2024-06-04  8:28 ` Hans de Goede
2024-06-04 13:41 ` Andi Shyti
2024-06-04 18:25 ` Rodrigo Vivi
2024-06-04 18:42   ` Linus Torvalds
2024-06-05  4:28 ` Gautham R. Shenoy
2024-06-05 11:17 ` AngeloGioacchino Del Regno

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=Zmi9bVdd8uNeqkWl@yury-ThinkPad \
    --to=yury.norov@gmail.com \
    --cc=AVKrasnov@sberdevices.ru \
    --cc=airlied@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andi.shyti@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=bristot@kernel.org \
    --cc=bristot@redhat.com \
    --cc=broonie@kernel.org \
    --cc=bsegall@google.com \
    --cc=cassel@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=clemens@ladisch.de \
    --cc=dakr@redhat.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=dlemoal@kernel.org \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=ebiggers@google.com \
    --cc=edumazet@google.com \
    --cc=eric.snowberg@oracle.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=hdegoede@redhat.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=hughd@google.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=jbaron@akamai.com \
    --cc=jdelvare@suse.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jirislaby@kernel.org \
    --cc=jmorris@namei.org \
    --cc=johannes.berg@intel.com \
    --cc=john.johansen@canonical.com \
    --cc=jonathanh@nvidia.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=juri.lelli@redhat.com \
    --cc=keescook@chromium.org \
    --cc=kent.overstreet@linux.dev \
    --cc=kherbst@redhat.com \
    --cc=kishon@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=kvalo@kernel.org \
    --cc=lee@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lyude@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mgorman@suse.de \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=miriam.rachel.korenblit@intel.com \
    --cc=mripard@kernel.org \
    --cc=npiggin@gmail.com \
    --cc=o-takashi@sakamocchi.jp \
    --cc=pabeni@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=pavel@ucw.cz \
    --cc=pdeschrijver@nvidia.com \
    --cc=perex@perex.cz \
    --cc=peterz@infradead.org \
    --cc=pgaikwad@nvidia.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rafael@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rjui@broadcom.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=rrichter@amd.com \
    --cc=s.shtylyov@omp.ru \
    --cc=sboyd@kernel.org \
    --cc=serge@hallyn.com \
    --cc=sre@kernel.org \
    --cc=teackot@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=thierry.reding@gmail.com \
    --cc=tiwai@suse.com \
    --cc=tiwai@suse.de \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tursulin@ursulin.net \
    --cc=tzimmermann@suse.de \
    --cc=ulf.hansson@linaro.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vkoul@kernel.org \
    --cc=vschneid@redhat.com \
    /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