From: "Dr. David Alan Gilbert" <dave@treblig.org>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Julia Lawall <julia.lawall@inria.fr>,
Theodore Tso <tytso@mit.edu>, Sasha Levin <sashal@kernel.org>,
Gabriele Paoloni <gpaoloni@redhat.com>,
Kate Stewart <kstewart@linuxfoundation.org>,
Chuck Wolber <chuckwolber@gmail.com>,
Dmitry Vyukov <dvyukov@google.com>,
Mark Rutland <mark.rutland@arm.com>,
Thomas Gleixner <tglx@linutronix.de>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Shuah Khan <skhan@linuxfoundation.org>,
Chris Mason <clm@meta.com>,
linux-kernel@vger.kernel.org
Subject: Re: Follow-up on Linux-kernel code accessibility
Date: Mon, 29 Dec 2025 17:02:04 +0000 [thread overview]
Message-ID: <aVK0DC89tnk-qW6-@gallifrey> (raw)
In-Reply-To: <c5f082e3-5923-4965-8e4a-3281258d3634@paulmck-laptop>
* Paul E. McKenney (paulmck@kernel.org) wrote:
> On Mon, Dec 29, 2025 at 10:40:05AM -0500, Steven Rostedt wrote:
> > On Sun, 28 Dec 2025 10:36:39 +0100 (CET)
> > Julia Lawall <julia.lawall@inria.fr> wrote:
> >
> > > > > > > j = (j + 2) / 3;
> > > > > >
> > > > > > "Divide by three rounding up."
> >
> > That's as useful as:
> >
> > /* Add one to X */
> > x++;
> >
> > > > >
> > > > > That's not *that* obvious, but ok, but then why 3?
> > > > >
> >
> > Bingo! You win a cigar! :-)
> >
> > I know that was a round up (and yes, as David pointed out, we have macros
> > for that too). The question is why are you dividing it by 3? I don't see
> > anything in that function which suggests the reason for needing to divide j
> > by 3.
> >
> > If the comments you were adding in the past was things like "Divide by
> > three rounding up" then yeah, I can see why people would say you have too
> > many comments. The comments are not to be discussing what is being done,
> > but why is it being done.
> >
> > WRITE_ONCE(rcu_state.jiffies_kick_kthreads,
> > jiffies + (j ? 3 * j : 2));
> >
> >
> > Why the: (j ? 3 * j : 2) ?
> >
> > Why is 3 so magical?
> >
> > /*
> > * j is the Father, Son and Holy Ghost.
> > * But only one may be active at a time.
> > * They each take a third. Father is first,
> > * Son is second, and Holy Ghost is third.
> > */
> > j = (j + 2) / 3;
> >
> > /*
> > * j may not be zero, as that would lead to
> > * damnation.
> > */
> > if (j <= 0)
> > j = 1;
>
> I would of course nack that comment, amusing though it might be to track
> others' reactions to it over time. ;-)
>
> So you are now unwilling to do a walkthrough? That would be unfortunate.
>
> If your view is that I should just answer the question so that
> everyone can get on with life, please keep in mind that there are some
> tens of thousands of other lines of code in Linux-kernel RCU. It is
> therefore only reasonable that I insist upon a more organized approach.
I'm actually not interested in the answer to what the magical 3 is *;
I just think this piece of code is a nice example of code that has
poor accessibility - both for human and AI - although frankly the
humans might find it harder.
My point of my previous response was that I don't think this is an
example of something that needs clever extra stuff for some of the
accessibility issues; just the basics of not using magic constants
and making sure clever tricks are either commented or use
appropriate named functions. That's just basic good style!
> In addition, as noted earlier [1], you guys are members of one of the
> smaller audiences that need my assistance. Plus you were on CC for the
> patch that added this line. ;-)
>
> On the other hand, if your view is instead that because the three of
> you don't immediately grok this line of code, I should be willing to
> take hundreds of lines of LLM-generated comments for each and every
> non-trivial RCU function (for some TBD definition of "non-trivial"),
> sorry, but no, that does not follow.
That indeed would be terrible; but a few clear basic comments around
clever stuff would be great.
Dave
(* It's obviously for Huey, Dewey, and Louie)
> Thanx, Paul
>
> [1] https://lore.kernel.org/all/fe8c7e28-b5fe-4411-b27c-b2efd89a74c7@paulmck-laptop/
--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux | Happy \
\ dave @ treblig.org | | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/
next prev parent reply other threads:[~2025-12-29 17:02 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 19:49 Follow-up on Linux-kernel code accessibility Paul E. McKenney
2025-12-18 22:09 ` David Laight
2025-12-19 0:20 ` Paul E. McKenney
2025-12-19 6:51 ` Julia Lawall
2025-12-19 17:09 ` Theodore Tso
2025-12-19 17:59 ` Sasha Levin
2025-12-19 18:28 ` Steven Rostedt
2025-12-20 0:36 ` Paul E. McKenney
2025-12-22 15:42 ` Steven Rostedt
2025-12-23 23:46 ` Paul E. McKenney
2025-12-24 14:11 ` Steven Rostedt
2025-12-25 15:03 ` Theodore Tso
2025-12-25 18:22 ` Paul E. McKenney
2025-12-26 16:48 ` Steven Rostedt
2025-12-26 18:44 ` Paul E. McKenney
2025-12-26 19:22 ` Theodore Tso
2025-12-26 20:35 ` Steven Rostedt
2025-12-27 1:04 ` Paul E. McKenney
2025-12-27 6:16 ` Julia Lawall
2025-12-27 23:28 ` Paul E. McKenney
2025-12-27 23:32 ` Julia Lawall
2025-12-28 1:26 ` Paul E. McKenney
2025-12-28 1:48 ` Dr. David Alan Gilbert
2025-12-28 5:16 ` Paul E. McKenney
2025-12-28 9:36 ` Julia Lawall
2025-12-29 15:40 ` Steven Rostedt
2025-12-29 16:16 ` Paul E. McKenney
2025-12-29 17:02 ` Dr. David Alan Gilbert [this message]
2025-12-29 17:37 ` Paul E. McKenney
2025-12-29 18:10 ` Dr. David Alan Gilbert
2025-12-29 18:59 ` Paul E. McKenney
2025-12-29 20:35 ` Steven Rostedt
2025-12-29 22:05 ` Dr. David Alan Gilbert
2026-01-09 1:35 ` Paul E. McKenney
2026-01-09 1:34 ` Paul E. McKenney
2026-01-09 14:58 ` Steven Rostedt
2026-01-09 18:31 ` Paul E. McKenney
2026-01-11 3:30 ` Theodore Tso
2026-01-11 17:11 ` Steven Rostedt
2026-01-12 5:06 ` Paul E. McKenney
2026-01-12 7:05 ` Julia Lawall
2026-01-12 16:57 ` Paul E. McKenney
2025-12-29 23:50 ` Theodore Tso
2025-12-30 0:19 ` Steven Rostedt
2025-12-30 0:34 ` Steven Rostedt
2026-01-09 2:23 ` Paul E. McKenney
2025-12-28 12:46 ` Dr. David Alan Gilbert
2025-12-29 0:03 ` Paul E. McKenney
2025-12-25 18:18 ` Paul E. McKenney
2025-12-26 16:51 ` Steven Rostedt
2025-12-26 18:36 ` Paul E. McKenney
2025-12-19 21:05 ` Chris Mason
2025-12-20 4:00 ` Theodore Tso
2026-01-06 18:08 ` Lorenzo Stoakes
2026-01-13 13:03 ` Chris Mason
2025-12-20 0:31 ` Paul E. McKenney
2026-01-06 18:05 ` Lorenzo Stoakes
2026-01-09 1:40 ` Paul E. McKenney
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=aVK0DC89tnk-qW6-@gallifrey \
--to=dave@treblig.org \
--cc=chuckwolber@gmail.com \
--cc=clm@meta.com \
--cc=dvyukov@google.com \
--cc=gpaoloni@redhat.com \
--cc=julia.lawall@inria.fr \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mark.rutland@arm.com \
--cc=paulmck@kernel.org \
--cc=rostedt@goodmis.org \
--cc=sashal@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=tglx@linutronix.de \
--cc=tytso@mit.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.