lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aVEmiQBlnGO-tOlT@gallifrey>
Date: Sun, 28 Dec 2025 12:46:01 +0000
From: "Dr. David Alan Gilbert" <dave@...blig.org>
To: "Paul E. McKenney" <paulmck@...nel.org>
Cc: Julia Lawall <julia.lawall@...ia.fr>, Theodore Tso <tytso@....edu>,
	Steven Rostedt <rostedt@...dmis.org>,
	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

* Paul E. McKenney (paulmck@...nel.org) wrote:

<snip>

> > > > 
> > > > j = (j + 2) / 3;
> > > 
> > > "Divide by three rounding up."
> > 
> > That's not *that* obvious, but ok, but then why 3?
> > 
> > Then later there is:
> >          WRITE_ONCE(rcu_state.jiffies_kick_kthreads,
> >                    jiffies + (j ? 3 * j : 2));
> > 
> > Which I assume is related - but then why the 2?
> 
> Would the two of you (Julia and Dave) like to join in with Steve and
> myself walking through this function and its caller?

Not sure what you mean join in; not really set up for a call etc at the
moment, but happy to continue a mail chain.

But, if we're talking about the understandability of these few lines,
it looks like this could be something like:


   // We have 3 ..... for the case when ...
   const unsigned long something = 3;
....
   j = DIV_ROUND_UP(j, something);

which would seem to make it more readable with very little effort.

(Hmm, since j is unsigned long why do we have a test of:
    if  (j <= 0) 
      j = 1
)

Dave

> > Curiosly my local tame Qwen3 LLM explained the rounding up:
> > 
> > > I see some code doing 'j = (j + 2) / 3'  - what's it trying to do?
> > The expression `j = (j + 2) / 3` is a clever way to **round up an
> > integer division by 3** — that is, it computes the ceiling of `j / 3`
> > for non-negative integers.
> 
> Good to see!
> 
> 							Thanx, Paul
> 
> > Dave
> > 
> > > 
> > > 							Thanx, Paul
> > > 
> > > > > > julia
> > > > > >
> > > > > >
> > > > > >
> > > > > > >
> > > > > > > 							Thanx, Paul
> > > > > > >
> > > > > > > [1] https://docs.google.com/document/d/1GCdQC8SDbb54W1shjEXqGZ0Rq8a6kIeYutdSIajfpLA/edit?pli=1&tab=t.0#heading=h.ytgz5i5df43s
> > > > > > >
> > > > > > > [2] https://www.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.html
> > > > > > >
> > > > >
> > > 
> > -- 
> >  -----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   |_______/
-- 
 -----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   |_______/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ