Re: Follow-up on Linux-kernel code accessibility
From: Steven Rostedt
Date: Mon Dec 29 2025 - 10:40:23 EST
On Sun, 28 Dec 2025 10:36:39 +0100 (CET)
Julia Lawall <julia.lawall@xxxxxxxx> 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