* [PATCH -perfbook 1/6] runlatex.sh: Cope with missing cleveref.sty
2026-06-23 10:20 [PATCH -perfbook 0/6] 2nd batch for June 2026 Akira Yokosawa
@ 2026-06-23 10:21 ` Akira Yokosawa
2026-06-23 10:22 ` [PATCH -perfbook 2/6] Stop loading braket.sty Akira Yokosawa
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Akira Yokosawa @ 2026-06-23 10:21 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
Since commit 1bc3abddbf59 ("Stop using "cleveref" with LaTeX2e
<2024-11-01> and later"), building perfbook doesn't need cleveref.
Warning on old cleveref can be skipped now.
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
utilities/runlatex.sh | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/utilities/runlatex.sh b/utilities/runlatex.sh
index 9a060897..7e074c9f 100644
--- a/utilities/runlatex.sh
+++ b/utilities/runlatex.sh
@@ -184,14 +184,17 @@ else
echo "'$basename.pdf' is ready, with above warning(s) ignored."
fi
# cleveref version check (Ubuntu 18.04 LTS has buggy one
-if grep -q -F "packageversion{0.21.1}" `kpsewhich cleveref.sty`
-then
+CLEVEREF_STY=`kpsewhich cleveref.sty`
+if [ "$CLEVEREF_STY" != "" ] ; then
+ if grep -q -F "packageversion{0.21.1}" $CLEVEREF_STY
+ then
echo "############################################################"
echo "### Buggy version of LaTeX package 'cleveref' detected!! ###"
echo "### (Known issue on Ubuntu 18.04 LTS) ###"
echo "### Required TeX Live is 2019/Debian or later. ###"
echo "### Consider upgrading to Ubuntu 20.04 LTS or later. ###"
echo "############################################################"
+ fi
fi
# to avoid redundant run of bibtex and pdflatex
touch $basename.bbl
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH -perfbook 2/6] Stop loading braket.sty
2026-06-23 10:20 [PATCH -perfbook 0/6] 2nd batch for June 2026 Akira Yokosawa
2026-06-23 10:21 ` [PATCH -perfbook 1/6] runlatex.sh: Cope with missing cleveref.sty Akira Yokosawa
@ 2026-06-23 10:22 ` Akira Yokosawa
2026-06-23 10:26 ` [PATCH -perfbook 3/6] defer/rcuintro: Tweak Listings 9.13 and 9.14 by employing fancyvrb Akira Yokosawa
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Akira Yokosawa @ 2026-06-23 10:22 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
It was needed for a section removed back in commit 972946a5298a
("future/QC: Remove quantum-computing section"). Comment it out.
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
perfbook-lt.tex | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/perfbook-lt.tex b/perfbook-lt.tex
index ba40146e..0dc05325 100644
--- a/perfbook-lt.tex
+++ b/perfbook-lt.tex
@@ -92,7 +92,7 @@
\usepackage{epigraph}[2020/01/02] % latest version prevents orphaned epigraph
\setlength{\epigraphwidth}{2.6in}
\usepackage[xspace]{ellipsis}
-\usepackage{braket} % for \ket{} macro in QC section
+%\usepackage{braket} % for \ket{} macro in QC section
\usepackage{siunitx} % for \num{} macro and \unit{} (such as \percent)
\sisetup{group-minimum-digits=4,group-separator={,},group-digits=integer}
\providecommand{\unit}{\si} % for siunitx < 3.0
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH -perfbook 3/6] defer/rcuintro: Tweak Listings 9.13 and 9.14 by employing fancyvrb
2026-06-23 10:20 [PATCH -perfbook 0/6] 2nd batch for June 2026 Akira Yokosawa
2026-06-23 10:21 ` [PATCH -perfbook 1/6] runlatex.sh: Cope with missing cleveref.sty Akira Yokosawa
2026-06-23 10:22 ` [PATCH -perfbook 2/6] Stop loading braket.sty Akira Yokosawa
@ 2026-06-23 10:26 ` Akira Yokosawa
2026-06-23 10:28 ` [PATCH -perfbook 4/6] defer/rcuintro: More tweaks for Listings 9.13 and 9.14 Akira Yokosawa
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Akira Yokosawa @ 2026-06-23 10:26 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
For better consistency in presenting code snippets, employ
fancyvrb's Verbatim env. Automate line counting as well.
While here, do "s/-/--/" for "lines~C1-C3" as well.
(Line number labeling/referencing might be automated in the
future ...)
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
defer/rcuintro.tex | 96 +++++++++++++++++++++++++++-------------------
1 file changed, 57 insertions(+), 39 deletions(-)
diff --git a/defer/rcuintro.tex b/defer/rcuintro.tex
index 21a99243..596f138f 100644
--- a/defer/rcuintro.tex
+++ b/defer/rcuintro.tex
@@ -69,64 +69,82 @@ can be implemented with a single load instruction, exactly the instruction
that would normally be used in single-threaded code.
\begin{listing}[tb]
-{ \small
-\begin{verbatim}
- A1 p = gp;
- A2 do_something_with(p->a);
- A3 do_something_with(p->b);
-\end{verbatim}
+\small
+\fvset{numbers=left,numbersep=5pt,fontsize=\scriptsize,frame=single,xleftmargin=15pt,xrightmargin=5pt}
+{\renewcommand{\theFancyVerbLine}{%
+ {\rmfamily\tiny A\arabic{FancyVerbLine}}}
+\begin{Verbatim}
+ p = gp;
+ do_something_with(p->a);
+ do_something_with(p->b);
+\end{Verbatim}
+}
Might be transformed to:
-\begin{verbatim}
- B1 p = gp;
- B2 do_something_with(p->a);
- B3 p = gp;
- B4 do_something_with(p->b);
-\end{verbatim}
+{\renewcommand{\theFancyVerbLine}{%
+ {\rmfamily\tiny B\arabic{FancyVerbLine}}}
+\begin{Verbatim}
+ p = gp;
+ do_something_with(p->a);
+ p = gp;
+ do_something_with(p->b);
+\end{Verbatim}
+}
The compiler assumes normal variables do not spontaneously change,
\co{do_something_with()} might use many machine registers, and this
transformation reduces register pressure.
-But if some other thread changes \co{gp} between lines~1 and~3 of the
+But if some other thread changes \co{gp} between lines~B1 and~B3 of the
transformed code, the values of \co{p->a} and \co{p->b} will be mismatched.
Prevent this by using \co{rcu_dereference()} as follows:
-\begin{verbatim}
- C1 p = rcu_dereference(gp);
- C2 do_something_with(p->a);
- C3 do_something_with(p->b);
-\end{verbatim}
+{\renewcommand{\theFancyVerbLine}{%
+ {\rmfamily\tiny C\arabic{FancyVerbLine}}}
+\begin{Verbatim}
+ p = rcu_dereference(gp);
+ do_something_with(p->a);
+ do_something_with(p->b);
+\end{Verbatim}
}
\caption{Compilers Can Reload Values}
\label{lst:defer:Compilers Can Reload Values}
\end{listing}
\begin{listing}[tb]
-{ \small
-\begin{verbatim}
- A1 p = malloc(sizeof(*p));
- A2 p->a = compute_value();
- A3 p->b = 42;
- A4 gp = p;
-\end{verbatim}
+\small
+\fvset{numbers=left,numbersep=5pt,fontsize=\scriptsize,frame=single,xleftmargin=15pt,xrightmargin=5pt}
+{\renewcommand{\theFancyVerbLine}{%
+ {\rmfamily\tiny A\arabic{FancyVerbLine}}}
+\begin{Verbatim}
+ p = malloc(sizeof(*p));
+ p->a = compute_value();
+ p->b = 42;
+ gp = p;
+\end{Verbatim}
+}
Might be transformed to:
-\begin{verbatim}
- B1 p = malloc(sizeof(*p));
- B2 gp = p;
- B3 p->a = compute_value();
- B4 p->b = 42;
-\end{verbatim}
+{\renewcommand{\theFancyVerbLine}{%
+ {\rmfamily\tiny B\arabic{FancyVerbLine}}}
+\begin{Verbatim}
+ p = malloc(sizeof(*p));
+ gp = p;
+ p->a = compute_value();
+ p->b = 42;
+\end{Verbatim}
+}
The compiler assumes normal variables are not concurrently accessed,
and thus that the order of stores does not matter.
If \co{compute_value()} was inlined, this transformation might produce
better code.
In this example, if some other thread loads \co{gp} immediately after
-line~2 of the transformed code, that thread might see pre-initialization
+line~B2 of the transformed code, that thread might see pre-initialization
garbage in \co{p->a} and \co{p->b}.
Prevent this by using \co{rcu_assign_pointer()} as follows:
-\begin{verbatim}
- C1 p = malloc(sizeof(*p));
- C2 p->a = compute_value();
- C3 p->b = 42;
- C4 rcu_assign_pointer(gp, p);
-\end{verbatim}
+{\renewcommand{\theFancyVerbLine}{%
+ {\rmfamily\tiny C\arabic{FancyVerbLine}}}
+\begin{Verbatim}
+ p = malloc(sizeof(*p));
+ p->a = compute_value();
+ p->b = 42;
+ rcu_assign_pointer(gp, p);
+\end{Verbatim}
}
\caption{Compilers Can Reorder Accesses}
\label{lst:defer:Compilers Can Reorder Accesses}
@@ -146,7 +164,7 @@ This transformation would fatally confuse any implementation of
\co{do_something_with()} that assumed that it was being passed values
from the same structure.
To prevent this transformation, use \co{rcu_dereference()} as
-shown on lines~C1-C3 of this listing, thus informing the compiler of the
+shown on lines~C1--C3 of this listing, thus informing the compiler of the
possibility of concurrent updates to \co{gp}.
To see the need for \co{rcu_assign_pointer()}, please see lines~A1--A4 of
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH -perfbook 4/6] defer/rcuintro: More tweaks for Listings 9.13 and 9.14
2026-06-23 10:20 [PATCH -perfbook 0/6] 2nd batch for June 2026 Akira Yokosawa
` (2 preceding siblings ...)
2026-06-23 10:26 ` [PATCH -perfbook 3/6] defer/rcuintro: Tweak Listings 9.13 and 9.14 by employing fancyvrb Akira Yokosawa
@ 2026-06-23 10:28 ` Akira Yokosawa
2026-06-23 10:30 ` [PATCH -perfbook 5/6] defer/rcufundamental: Fix typo ("cannot not return") Akira Yokosawa
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Akira Yokosawa @ 2026-06-23 10:28 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
To make text parts in those floating listings easier to distinguish
from those of main contents, fine tune their appearance by:
1) Use \footnotesize,
2) Widen margins, and
3) Tweak vertical spaces above/below framed code snippets.
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
defer/rcuintro.tex | 34 ++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/defer/rcuintro.tex b/defer/rcuintro.tex
index 596f138f..6997378b 100644
--- a/defer/rcuintro.tex
+++ b/defer/rcuintro.tex
@@ -2,6 +2,10 @@
% mainfile: ../perfbook.tex
% SPDX-License-Identifier: CC-BY-SA-3.0
+\newcommand{\adjvspaceabove}{\vspace*{2pt}}
+\newcommand{\adjvspacebelow}{\vspace*{-1pt}}
+\newcommand{\adjvspacebottom}{\vspace*{-2pt}}
+
\subsection{Introduction to RCU}
\label{sec:defer:Introduction to RCU}
@@ -69,26 +73,29 @@ can be implemented with a single load instruction, exactly the instruction
that would normally be used in single-threaded code.
\begin{listing}[tb]
-\small
-\fvset{numbers=left,numbersep=5pt,fontsize=\scriptsize,frame=single,xleftmargin=15pt,xrightmargin=5pt}
+\begin{adjustwidth}{10pt}{5pt}
+\footnotesize
+\fvset{numbers=left,numbersep=5pt,fontsize=\scriptsize,frame=single,xrightmargin=5pt}
{\renewcommand{\theFancyVerbLine}{%
{\rmfamily\tiny A\arabic{FancyVerbLine}}}
+\adjvspaceabove%
\begin{Verbatim}
p = gp;
do_something_with(p->a);
do_something_with(p->b);
\end{Verbatim}
-}
+}\adjvspacebelow
Might be transformed to:
{\renewcommand{\theFancyVerbLine}{%
{\rmfamily\tiny B\arabic{FancyVerbLine}}}
+\adjvspaceabove%
\begin{Verbatim}
p = gp;
do_something_with(p->a);
p = gp;
do_something_with(p->b);
\end{Verbatim}
-}
+}\adjvspacebelow
The compiler assumes normal variables do not spontaneously change,
\co{do_something_with()} might use many machine registers, and this
transformation reduces register pressure.
@@ -97,38 +104,43 @@ transformed code, the values of \co{p->a} and \co{p->b} will be mismatched.
Prevent this by using \co{rcu_dereference()} as follows:
{\renewcommand{\theFancyVerbLine}{%
{\rmfamily\tiny C\arabic{FancyVerbLine}}}
+\adjvspaceabove%
\begin{Verbatim}
p = rcu_dereference(gp);
do_something_with(p->a);
do_something_with(p->b);
\end{Verbatim}
-}
+}\adjvspacebelow
+\end{adjustwidth}\adjvspacebottom
\caption{Compilers Can Reload Values}
\label{lst:defer:Compilers Can Reload Values}
\end{listing}
\begin{listing}[tb]
-\small
-\fvset{numbers=left,numbersep=5pt,fontsize=\scriptsize,frame=single,xleftmargin=15pt,xrightmargin=5pt}
+\begin{adjustwidth}{10pt}{5pt}
+\footnotesize
+\fvset{numbers=left,numbersep=5pt,fontsize=\scriptsize,frame=single,xrightmargin=5pt}
{\renewcommand{\theFancyVerbLine}{%
{\rmfamily\tiny A\arabic{FancyVerbLine}}}
+\adjvspaceabove%
\begin{Verbatim}
p = malloc(sizeof(*p));
p->a = compute_value();
p->b = 42;
gp = p;
\end{Verbatim}
-}
+}\adjvspacebelow
Might be transformed to:
{\renewcommand{\theFancyVerbLine}{%
{\rmfamily\tiny B\arabic{FancyVerbLine}}}
+\adjvspaceabove%
\begin{Verbatim}
p = malloc(sizeof(*p));
gp = p;
p->a = compute_value();
p->b = 42;
\end{Verbatim}
-}
+}\adjvspacebelow
The compiler assumes normal variables are not concurrently accessed,
and thus that the order of stores does not matter.
If \co{compute_value()} was inlined, this transformation might produce
@@ -139,13 +151,15 @@ garbage in \co{p->a} and \co{p->b}.
Prevent this by using \co{rcu_assign_pointer()} as follows:
{\renewcommand{\theFancyVerbLine}{%
{\rmfamily\tiny C\arabic{FancyVerbLine}}}
+\adjvspaceabove%
\begin{Verbatim}
p = malloc(sizeof(*p));
p->a = compute_value();
p->b = 42;
rcu_assign_pointer(gp, p);
\end{Verbatim}
-}
+}\adjvspacebelow
+\end{adjustwidth}\adjvspacebottom
\caption{Compilers Can Reorder Accesses}
\label{lst:defer:Compilers Can Reorder Accesses}
\end{listing}
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH -perfbook 5/6] defer/rcufundamental: Fix typo ("cannot not return")
2026-06-23 10:20 [PATCH -perfbook 0/6] 2nd batch for June 2026 Akira Yokosawa
` (3 preceding siblings ...)
2026-06-23 10:28 ` [PATCH -perfbook 4/6] defer/rcuintro: More tweaks for Listings 9.13 and 9.14 Akira Yokosawa
@ 2026-06-23 10:30 ` Akira Yokosawa
2026-06-23 10:31 ` [PATCH -perfbook 6/6] Update rcu-test-ratio for Linux v7.1 Akira Yokosawa
2026-06-23 16:33 ` [PATCH -perfbook 0/6] 2nd batch for June 2026 Paul E. McKenney
6 siblings, 0 replies; 8+ messages in thread
From: Akira Yokosawa @ 2026-06-23 10:30 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
defer/rcufundamental.tex | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/defer/rcufundamental.tex b/defer/rcufundamental.tex
index edb90e0d..7e06a5ab 100644
--- a/defer/rcufundamental.tex
+++ b/defer/rcufundamental.tex
@@ -220,7 +220,7 @@ pre-existing RCU read-side critical section to complete, and
waiting for a \emph{grace
period}~\cite{MathieuDesnoyers2012URCU,McKenney:2013:SDS:2483852.2483867}.
-In other words, \co{synchronize_rcu()} cannot not return until all
+In other words, \co{synchronize_rcu()} cannot return until all
pre-existing RCU read-side critical sections have completed.
In other words, if one task\footnote{
Or CPU, process, thread, or whatever name you prefer.}
@@ -281,7 +281,7 @@ thus guaranteeing that \co{r2}'s final value will be zero.
But suppose that the \co{rcu_read_unlock()} ending a given task's RCU
read-side critical section is executed after the return from a second
task's call to \co{synchronize_rcu()}.
-Because \co{synchronize_rcu()} cannot not return until all task have
+Because \co{synchronize_rcu()} cannot return until all task have
exited any pre-existing RCU read-side critical sections, it must be the
case that the second task called \co{synchronize_rcu()} before first
task executed the matching \co{rcu_read_lock()}.
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH -perfbook 6/6] Update rcu-test-ratio for Linux v7.1
2026-06-23 10:20 [PATCH -perfbook 0/6] 2nd batch for June 2026 Akira Yokosawa
` (4 preceding siblings ...)
2026-06-23 10:30 ` [PATCH -perfbook 5/6] defer/rcufundamental: Fix typo ("cannot not return") Akira Yokosawa
@ 2026-06-23 10:31 ` Akira Yokosawa
2026-06-23 16:33 ` [PATCH -perfbook 0/6] 2nd batch for June 2026 Paul E. McKenney
6 siblings, 0 replies; 8+ messages in thread
From: Akira Yokosawa @ 2026-06-23 10:31 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
CodeSamples/formal/data/rcu-test.dat | 1 +
1 file changed, 1 insertion(+)
diff --git a/CodeSamples/formal/data/rcu-test.dat b/CodeSamples/formal/data/rcu-test.dat
index 722a08d6..c04f613d 100644
--- a/CodeSamples/formal/data/rcu-test.dat
+++ b/CodeSamples/formal/data/rcu-test.dat
@@ -108,3 +108,4 @@ v6.16 22370 12983 35353 36.7
"" 22542 13299 35841 37.1
"" 22884 13848 36732 37.7
v7.0 22359 14019 36378 38.5
+"" 22456 13924 36380 38.3
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH -perfbook 0/6] 2nd batch for June 2026
2026-06-23 10:20 [PATCH -perfbook 0/6] 2nd batch for June 2026 Akira Yokosawa
` (5 preceding siblings ...)
2026-06-23 10:31 ` [PATCH -perfbook 6/6] Update rcu-test-ratio for Linux v7.1 Akira Yokosawa
@ 2026-06-23 16:33 ` Paul E. McKenney
6 siblings, 0 replies; 8+ messages in thread
From: Paul E. McKenney @ 2026-06-23 16:33 UTC (permalink / raw)
To: Akira Yokosawa; +Cc: perfbook
On Tue, Jun 23, 2026 at 07:20:19PM +0900, Akira Yokosawa wrote:
> Hi Paul,
>
> I found recently added listings 9.13 and 9.14 can be made
> more consistent with other code snippets.
>
> Patches 3/6 and 4/6 are my attempts for making them nicer.
>
> Patch 6/6 is the usual update of rcu-test-ratio.
>
> The other ones are minor fixes.
Queued and pushed, thank you! I will use the new three-part table
format in similar changes planned for Section 4.3.4 ("Accessing Shared
Variables"), so I don't feel quite so bad about not having gotten to
that yet. ;-)
Thanx, Paul
> Thanks, Akira
> --
> Akira Yokosawa (6):
> runlatex.sh: Cope with missing cleveref.sty
> Stop loading braket.sty
> defer/rcuintro: Tweak Listings 9.13 and 9.14 by employing fancyvrb
> defer/rcuintro: More tweaks for Listings 9.13 and 9.14
> defer/rcufundamental: Fix typo ("cannot not return")
> Update rcu-test-ratio for Linux v7.1
>
> CodeSamples/formal/data/rcu-test.dat | 1 +
> defer/rcufundamental.tex | 4 +-
> defer/rcuintro.tex | 114 +++++++++++++++++----------
> perfbook-lt.tex | 2 +-
> utilities/runlatex.sh | 7 +-
> 5 files changed, 82 insertions(+), 46 deletions(-)
>
>
> base-commit: d7c24ba666e292263b36954f8d07974422f3e034
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 8+ messages in thread