[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251226114830.6bc7a3eb@gandalf.local.home>
Date: Fri, 26 Dec 2025 11:48:30 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: "Theodore Tso" <tytso@....edu>
Cc: "Paul E. McKenney" <paulmck@...nel.org>, Sasha Levin
<sashal@...nel.org>, Julia Lawall <julia.lawall@...ia.fr>, 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 Thu, 25 Dec 2025 10:03:31 -0500
"Theodore Tso" <tytso@....edu> wrote:
> > There's a bit of magical manipulation of "j" that I have no idea why it's
> > doing that. ;-)
> >
> > I would love if Julia or Gabriele came up with some specification for that
> > function.
>
> I think we need to separate out two different things. The first is
> <<what>> the function is doing, and the other is <<how>> the function
> is doing it. The first is the specification, or the interface
> contract. The second is the implementation details that are important
> if you need to modify the function, or want to verify its corrections.
Agreed, but knowing what the function is doing should give you some idea of
how it is doing it.
"Loop doing repeated quiescent-state forcing until the grace period ends."
Is the only description of "what the function is doing", but it gives you
no clue to why it's using those magic numbers. There should be comments
about how the magic numbers relate to the what.
As Julia said in one of our meetings, the "what a function is doing" should
describe enough so that if you gave that to two different developers they
would come up with similar code. Different implementations, but at least
they should have the same result.
>
> I'm reminded of the ancient Unix documentation of how context
> switching was implemented on a PDP-11, "You are not expected to
> understand this". But as long as you understood what it was doing,
> the fact the magic wasn't described in the source code might be OK.
> OTOH, it's what inspired the Lion's Commentary on the Unix Source
> Code book. :-)
Reminds me of a saying I saw posted to a developer's desk back in 1992 at
Martin Marietta: "I don't document my code. If it was hard to write, it
should be hard to understand!" :-p
-- Steve
Powered by blists - more mailing lists