[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251229104005.18b25def@gandalf.local.home>
Date: Mon, 29 Dec 2025 10:40:05 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Julia Lawall <julia.lawall@...ia.fr>
Cc: "Paul E. McKenney" <paulmck@...nel.org>, "Dr. David Alan Gilbert"
<dave@...blig.org>, Theodore Tso <tytso@....edu>, Sasha Levin
<sashal@...nel.org>, Gabriele Paoloni <gpaoloni@...hat.com>, Kate Stewart
<kstewart@...uxfoundation.org>, Chuck Wolber <chuckwolber@...il.com>,
Dmitry Vyukov <dvyukov@...gle.com>, Mark Rutland <mark.rutland@....com>,
Thomas Gleixner <tglx@...utronix.de>, Lorenzo Stoakes
<lorenzo.stoakes@...cle.com>, Shuah Khan <skhan@...uxfoundation.org>, Chris
Mason <clm@...a.com>, linux-kernel@...r.kernel.org
Subject: Re: Follow-up on Linux-kernel code accessibility
On Sun, 28 Dec 2025 10:36:39 +0100 (CET)
Julia Lawall <julia.lawall@...ia.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;
-- Steve
Powered by blists - more mailing lists