Skip to contentSkip to conversation

TRIAL: Indentation tweaks around 'verbbox' environment

PATCH In review Akira Yokosawa 2 participants 9 messages Sep 7, 2016 – Sep 12, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 TRIAL: Indentation tweaks around 'verbbox' environment

From 480c37c4749ae4957791636e84e77566265613c2 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Thu, 8 Sep 2016 00:20:29 +0900
Subject: [PATCH] TRIAL: Indentation tweaks around 'verbbox' environment

This is a trial commit to avoid the side-effect of the "verbbox" environment, i.e., when it is used just after a section heading, the following paragraph loses implicit non-indentation.

This commit moves such a "verbbox" environment *before* the section heading.

There are also cases where two "verbbox" environments are placed just after section headings. To accommodate such cases, one of such "verbbox" need to be replaced with "myverbbox" environment to give another temporary verbatimbox content holder.

This commit includes an example of such a case.

Note that the "myverbbox" environment is provided in recent versions of the "verbatimbox" package, namely after v3.0.

If you have older versions of "verbatimbox" package, you need to update. Also the newer one requires the "readarray" package.

Please make sure you have those required packages.

---
 defer/toyrcu.tex | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)
defer/toyrcu.tex +17 -14
index cd334ed..01da2cc 100644
@@ -30,9 +30,6 @@ and free-running counters.
 Finally, Section~\ref{defer:Summary of Toy RCU Implementations}
 provides a summary and a list of desirable RCU properties.
 
-\subsubsection{Lock-Based RCU}
-\label{defer:Lock-Based RCU}
-
 { \scriptsize
 \begin{verbbox}
   1 static void rcu_read_lock(void)
@@ -52,6 +49,10 @@ provides a summary and a list of desirable RCU properties.
  15 }
 \end{verbbox}
 }
+
+\subsubsection{Lock-Based RCU}
+\label{defer:Lock-Based RCU}
+
 \begin{figure}[bp]
 \centering
 \theverbbox
@@ -434,9 +435,6 @@ suitable for a high-stress debugging environment.
 The next section describes a variation on the reference-counting
 scheme that is more favorable to writers.
 
-\subsubsection{Starvation-Free Counter-Based RCU}
-\label{defer:Starvation-Free Counter-Based RCU}
-
 { \scriptsize
 \begin{verbbox}
   1 DEFINE_SPINLOCK(rcu_gp_lock);
@@ -446,15 +444,9 @@ scheme that is more favorable to writers.
   5 DEFINE_PER_THREAD(int, rcu_read_idx);
 \end{verbbox}
 }
-\begin{figure}[tbp]
-\centering
-\theverbbox
-\caption{RCU Global Reference-Count Pair Data}
-\label{fig:defer:RCU Global Reference-Count Pair Data}
-\end{figure}
 
 { \scriptsize
-\begin{verbbox}
+\begin{myverbbox}{\verbboxa}
   1 static void rcu_read_lock(void)
   2 {
   3   int i;
@@ -483,11 +475,22 @@ scheme that is more favorable to writers.
  26   }
  27   __get_thread_var(rcu_nesting) = n - 1;
  28 }
-\end{verbbox}
+\end{myverbbox}
 }
+
+\subsubsection{Starvation-Free Counter-Based RCU}
+\label{defer:Starvation-Free Counter-Based RCU}
+
 \begin{figure}[tbp]
 \centering
 \theverbbox
+\caption{RCU Global Reference-Count Pair Data}
+\label{fig:defer:RCU Global Reference-Count Pair Data}
+\end{figure}
+
+\begin{figure}[tbp]
+\centering
+\verbboxa
 \caption{RCU Read-Side Using Global Reference-Count Pair}
 \label{fig:defer:RCU Read-Side Using Global Reference-Count Pair}
 \end{figure}
Signature · 1 line
1.9.1
#1 lore raw
Quoted 25 lines · Akira Yokosawa
Quoted 1 line

From 480c37c4749ae4957791636e84e77566265613c2 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Thu, 8 Sep 2016 00:20:29 +0900
Subject: [PATCH] TRIAL: Indentation tweaks around 'verbbox' environment

This is a trial commit to avoid the side-effect of the "verbbox" environment, i.e., when it is used just after a section heading, the following paragraph loses implicit non-indentation.

This commit moves such a "verbbox" environment *before* the section heading.

There are also cases where two "verbbox" environments are placed just after section headings. To accommodate such cases, one of such "verbbox" need to be replaced with "myverbbox" environment to give another temporary verbatimbox content holder.

This commit includes an example of such a case.

Note that the "myverbbox" environment is provided in recent versions of the "verbatimbox" package, namely after v3.0.

If you have older versions of "verbatimbox" package, you need to update. Also the newer one requires the "readarray" package.

Quoted 7 lines

Please make sure you have those required packages.

---
 defer/toyrcu.tex | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

Hi Paul,

So, this is what occurred to me.
The main idea is to move "verbbox" environment before the section heading. This patch contains only a small samples.
Does this level of modification acceptable in your viewpoint?

One concern is the requirement of fairly new "verbatimbox" environment. On Ubuntu 12.04, the one installed in texlive is too old.
On Ubuntu 14.04 and 16.04, it contains newer versions.

Thanks, Akira

#2 lore raw
Quoted 36 lines · Akira Yokosawa
Quoted 25 lines · Akira Yokosawa
Quoted 1 line

From 480c37c4749ae4957791636e84e77566265613c2 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Thu, 8 Sep 2016 00:20:29 +0900
Subject: [PATCH] TRIAL: Indentation tweaks around 'verbbox' environment

This is a trial commit to avoid the side-effect of the "verbbox" environment, i.e., when it is used just after a section heading, the following paragraph loses implicit non-indentation.

This commit moves such a "verbbox" environment *before* the section heading.

There are also cases where two "verbbox" environments are placed just after section headings. To accommodate such cases, one of such "verbbox" need to be replaced with "myverbbox" environment to give another temporary verbatimbox content holder.

This commit includes an example of such a case.

Note that the "myverbbox" environment is provided in recent versions of the "verbatimbox" package, namely after v3.0.

If you have older versions of "verbatimbox" package, you need to update. Also the newer one requires the "readarray" package.

Quoted 7 lines

Please make sure you have those required packages.

---
 defer/toyrcu.tex | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

Hi Paul,

Quoted 8 lines

So, this is what occurred to me.
The main idea is to move "verbbox" environment before the section heading. This patch contains only a small samples.
Does this level of modification acceptable in your viewpoint?

One concern is the requirement of fairly new "verbatimbox" environment. On Ubuntu 12.04, the one installed in texlive is too old.
On Ubuntu 14.04 and 16.04, it contains newer versions.

I am currently running Ubuntu 14.04, so it would work. But is there anything that could be done to make "verbbox" avoid causing this change?

Thanx, Paul

#3 lore raw
Quoted 42 lines · Paul E. McKenney
Quoted 41 lines · Akira Yokosawa
Quoted 25 lines · Akira Yokosawa
Quoted 1 line

From 480c37c4749ae4957791636e84e77566265613c2 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Thu, 8 Sep 2016 00:20:29 +0900
Subject: [PATCH] TRIAL: Indentation tweaks around 'verbbox' environment

This is a trial commit to avoid the side-effect of the "verbbox" environment, i.e., when it is used just after a section heading, the following paragraph loses implicit non-indentation.

This commit moves such a "verbbox" environment *before* the section heading.

There are also cases where two "verbbox" environments are placed just after section headings. To accommodate such cases, one of such "verbbox" need to be replaced with "myverbbox" environment to give another temporary verbatimbox content holder.

This commit includes an example of such a case.

Note that the "myverbbox" environment is provided in recent versions of the "verbatimbox" package, namely after v3.0.

If you have older versions of "verbatimbox" package, you need to update. Also the newer one requires the "readarray" package.

Quoted 7 lines

Please make sure you have those required packages.

---
 defer/toyrcu.tex | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

Hi Paul,

So, this is what occurred to me.
The main idea is to move "verbbox" environment before the section heading. This patch contains only a small samples.
Does this level of modification acceptable in your viewpoint?

Quoted 7 lines
Quoted 3 lines

One concern is the requirement of fairly new "verbatimbox" environment. On Ubuntu 12.04, the one installed in texlive is too old.
On Ubuntu 14.04 and 16.04, it contains newer versions.

I am currently running Ubuntu 14.04, so it would work. But is there anything that could be done to make "verbbox" avoid causing this change?

So I tried several modification of verbatimbox.sty to do so. But what I could do was to add a variant of "verbbox" named "verbboxh" which passes "afterheading"-ness to the next paragraph.

The way to do this can be found at
http://tex.stackexchange.com/questions/23265/suppressing-indentation-of-the-next-paragraph

But when I made the same change to "verbbox" without \@afterindentfalse to make it "afterheading"-ness aware, the resulting pdf looked weird with irregular vertical spacing before section headings.

It's far beyond my capability to figure out how to fix this.

Using the variant "verbboxh" in the LaTeX sources would be essentially the same as adding explicit \noindent's from a maintainer's viewpoint.

So moving the position of "verbbox" environment seems a good compromise for now. And by doing so, the position would be a good reminder of the side-effect.

What do you think?

Thanks, Akira

Quoted 3 lines

Thanx, Paul

#4 lore raw
Quoted 64 lines · Akira Yokosawa
Quoted 42 lines · Paul E. McKenney
Quoted 41 lines · Akira Yokosawa
Quoted 25 lines · Akira Yokosawa
Quoted 1 line

From 480c37c4749ae4957791636e84e77566265613c2 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Thu, 8 Sep 2016 00:20:29 +0900
Subject: [PATCH] TRIAL: Indentation tweaks around 'verbbox' environment

This is a trial commit to avoid the side-effect of the "verbbox" environment, i.e., when it is used just after a section heading, the following paragraph loses implicit non-indentation.

This commit moves such a "verbbox" environment *before* the section heading.

There are also cases where two "verbbox" environments are placed just after section headings. To accommodate such cases, one of such "verbbox" need to be replaced with "myverbbox" environment to give another temporary verbatimbox content holder.

This commit includes an example of such a case.

Note that the "myverbbox" environment is provided in recent versions of the "verbatimbox" package, namely after v3.0.

If you have older versions of "verbatimbox" package, you need to update. Also the newer one requires the "readarray" package.

Quoted 7 lines

Please make sure you have those required packages.

---
 defer/toyrcu.tex | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

Hi Paul,

So, this is what occurred to me.
The main idea is to move "verbbox" environment before the section heading. This patch contains only a small samples.
Does this level of modification acceptable in your viewpoint?

Quoted 7 lines
Quoted 3 lines

One concern is the requirement of fairly new "verbatimbox" environment. On Ubuntu 12.04, the one installed in texlive is too old.
On Ubuntu 14.04 and 16.04, it contains newer versions.

I am currently running Ubuntu 14.04, so it would work. But is there anything that could be done to make "verbbox" avoid causing this change?

So I tried several modification of verbatimbox.sty to do so. But what I could do was to add a variant of "verbbox" named "verbboxh" which passes "afterheading"-ness to the next paragraph.

The way to do this can be found at
http://tex.stackexchange.com/questions/23265/suppressing-indentation-of-the-next-paragraph

But when I made the same change to "verbbox" without \@afterindentfalse to make it "afterheading"-ness aware, the resulting pdf looked weird with irregular vertical spacing before section headings.

It's far beyond my capability to figure out how to fix this.

Quoted 7 lines

Using the variant "verbboxh" in the LaTeX sources would be essentially the same as adding explicit \noindent's from a maintainer's viewpoint.

So moving the position of "verbbox" environment seems a good compromise for now. And by doing so, the position would be a good reminder of the side-effect.

What do you think?

Would it make sense to file a bug report against verbbox and wait until the bug is fixed?

Thanx, Paul

Quoted 7 lines

Thanks, Akira

Quoted 3 lines

Thanx, Paul

#5 lore raw
Quoted 68 lines · Paul E. McKenney
Quoted 67 lines · Akira Yokosawa
Quoted 42 lines · Paul E. McKenney
Quoted 41 lines · Akira Yokosawa
Quoted 25 lines · Akira Yokosawa
Quoted 1 line

From 480c37c4749ae4957791636e84e77566265613c2 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Thu, 8 Sep 2016 00:20:29 +0900
Subject: [PATCH] TRIAL: Indentation tweaks around 'verbbox' environment

This is a trial commit to avoid the side-effect of the "verbbox" environment, i.e., when it is used just after a section heading, the following paragraph loses implicit non-indentation.

This commit moves such a "verbbox" environment *before* the section heading.

There are also cases where two "verbbox" environments are placed just after section headings. To accommodate such cases, one of such "verbbox" need to be replaced with "myverbbox" environment to give another temporary verbatimbox content holder.

This commit includes an example of such a case.

Note that the "myverbbox" environment is provided in recent versions of the "verbatimbox" package, namely after v3.0.

If you have older versions of "verbatimbox" package, you need to update. Also the newer one requires the "readarray" package.

Quoted 7 lines

Please make sure you have those required packages.

---
 defer/toyrcu.tex | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

Hi Paul,

So, this is what occurred to me.
The main idea is to move "verbbox" environment before the section heading. This patch contains only a small samples.
Does this level of modification acceptable in your viewpoint?

Quoted 7 lines
Quoted 3 lines

One concern is the requirement of fairly new "verbatimbox" environment. On Ubuntu 12.04, the one installed in texlive is too old.
On Ubuntu 14.04 and 16.04, it contains newer versions.

I am currently running Ubuntu 14.04, so it would work. But is there anything that could be done to make "verbbox" avoid causing this change?

So I tried several modification of verbatimbox.sty to do so. But what I could do was to add a variant of "verbbox" named "verbboxh" which passes "afterheading"-ness to the next paragraph.

The way to do this can be found at
http://tex.stackexchange.com/questions/23265/suppressing-indentation-of-the-next-paragraph

But when I made the same change to "verbbox" without \@afterindentfalse to make it "afterheading"-ness aware, the resulting pdf looked weird with irregular vertical spacing before section headings.

It's far beyond my capability to figure out how to fix this.

Using the variant "verbboxh" in the LaTeX sources would be essentially the same as adding explicit \noindent's from a maintainer's viewpoint.

Quoted 8 lines
Quoted 4 lines

So moving the position of "verbbox" environment seems a good compromise for now. And by doing so, the position would be a good reminder of the side-effect.

What do you think?

Would it make sense to file a bug report against verbbox and wait until the bug is fixed?

Well, it seems like we don't need to file a bug report.
We can use "verbbox" env within a "figure" env, and doing so, the "afterheading"-ness of the first paragraph can be preserved.

I'll compose a sample patch for you to confirm this.

Without your encouragement to let me avoid invasive modifications, I could not have noticed this.

Thanks, Akira

Quoted 11 lines

Thanx, Paul

Quoted 7 lines

Thanks, Akira

Quoted 3 lines

Thanx, Paul

#6 lore raw

RFC PATCH 1/1 toyrcu: Enclose 'verbbox' within 'figure'

In reply to Paul E. McKenney

From 1cbac7a606ed336367529414512d84005f92bf1f Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sun, 11 Sep 2016 11:33:33 +0900
Subject: [RFC PATCH] toyrcu: Enclose 'verbbox' within 'figure'

Bare "verbbox" environment just after a section heading causes the "afterheading"-ness of the first paragraph.
By enclosing the "verbbox" by a "figure" environment, we can avoid the side-effect.

This commit does the enclosing by moving \begin{figure} ahead of \begin{verbbox}.

---
 defer/toyrcu.tex | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
defer/toyrcu.tex +20 -20
index cd334ed..3b5a85c 100644
@@ -33,6 +33,7 @@ provides a summary and a list of desirable RCU properties.
 \subsubsection{Lock-Based RCU}
 \label{defer:Lock-Based RCU}
 
+\begin{figure}[bp]
 { \scriptsize
 \begin{verbbox}
   1 static void rcu_read_lock(void)
@@ -52,7 +53,6 @@ provides a summary and a list of desirable RCU properties.
  15 }
 \end{verbbox}
 }
-\begin{figure}[bp]
 \centering
 \theverbbox
 \caption{Lock-Based RCU Implementation}
@@ -92,6 +92,7 @@ preventing grace-period sharing.
 	also be a deadlock in any other RCU implementation?
 \QuickQuizAnswer{
 %
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 void foo(void)
@@ -115,7 +116,6 @@ preventing grace-period sharing.
  19 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{Deadlock in Lock-Based RCU Implementation}
@@ -171,6 +171,7 @@ in the next section.
 \subsubsection{Per-Thread Lock-Based RCU}
 \label{defer:Per-Thread Lock-Based RCU}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 static void rcu_read_lock(void)
@@ -194,7 +195,6 @@ in the next section.
  19 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{Per-Thread Lock-Based RCU Implementation}
@@ -291,6 +291,7 @@ the shortcomings of the lock-based implementation.
 \subsubsection{Simple Counter-Based RCU}
 \label{defer:Simple Counter-Based RCU}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 atomic_t rcu_refcnt;
@@ -317,7 +318,6 @@ the shortcomings of the lock-based implementation.
  22 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Implementation Using Single Global Reference Counter}
@@ -437,6 +437,7 @@ scheme that is more favorable to writers.
 \subsubsection{Starvation-Free Counter-Based RCU}
 \label{defer:Starvation-Free Counter-Based RCU}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 DEFINE_SPINLOCK(rcu_gp_lock);
@@ -446,13 +447,13 @@ scheme that is more favorable to writers.
   5 DEFINE_PER_THREAD(int, rcu_read_idx);
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Global Reference-Count Pair Data}
 \label{fig:defer:RCU Global Reference-Count Pair Data}
 \end{figure}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 static void rcu_read_lock(void)
@@ -485,7 +486,6 @@ scheme that is more favorable to writers.
  28 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Read-Side Using Global Reference-Count Pair}
@@ -579,6 +579,7 @@ the selected element of \co{rcu_refcnt}.
 Regardless of the nesting level, line~27 decrements this thread's
 instance of \co{rcu_nesting}.
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 void synchronize_rcu(void)
@@ -604,7 +605,6 @@ instance of \co{rcu_nesting}.
  21 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Update Using Global Reference-Count Pair}
@@ -771,6 +771,7 @@ scheme that provides greatly improved read-side performance and scalability.
 \subsubsection{Scalable Counter-Based RCU}
 \label{defer:Scalable Counter-Based RCU}
 
+\begin{figure}[tb]
 { \scriptsize
 \begin{verbbox}
   1 DEFINE_SPINLOCK(rcu_gp_lock);
@@ -780,13 +781,13 @@ scheme that provides greatly improved read-side performance and scalability.
   5 DEFINE_PER_THREAD(int, rcu_read_idx);
 \end{verbbox}
 }
-\begin{figure}[tb]
 \centering
 \theverbbox
 \caption{RCU Per-Thread Reference-Count Pair Data}
 \label{fig:defer:RCU Per-Thread Reference-Count Pair Data}
 \end{figure}
 
+\begin{figure}[tb]
 { \scriptsize
 \begin{verbbox}
   1 static void rcu_read_lock(void)
@@ -819,7 +820,6 @@ scheme that provides greatly improved read-side performance and scalability.
  28 }
 \end{verbbox}
 }
-\begin{figure}[tb]
 \centering
 \theverbbox
 \caption{RCU Read-Side Using Per-Thread Reference-Count Pair}
@@ -859,6 +859,7 @@ perform atomic operations.
 	But thankfully, it seems that no one runs Linux on 8-bit systems.
 } \QuickQuizEnd
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 static void flip_counter_and_wait(int i)
@@ -889,7 +890,6 @@ perform atomic operations.
  26 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Update Using Per-Thread Reference-Count Pair}
@@ -978,6 +978,7 @@ concurrent RCU updates.
 \subsubsection{Scalable Counter-Based RCU With Shared Grace Periods}
 \label{defer:Scalable Counter-Based RCU With Shared Grace Periods}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 DEFINE_SPINLOCK(rcu_gp_lock);
@@ -987,13 +988,13 @@ concurrent RCU updates.
   5 DEFINE_PER_THREAD(int, rcu_read_idx);
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Read-Side Using Per-Thread Reference-Count Pair and Shared Update Data}
 \label{fig:defer:RCU Read-Side Using Per-Thread Reference-Count Pair and Shared Update Data}
 \end{figure}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 static void rcu_read_lock(void)
@@ -1026,7 +1027,6 @@ concurrent RCU updates.
  28 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Read-Side Using Per-Thread Reference-Count Pair and Shared Update}
@@ -1051,6 +1051,7 @@ Figure~\ref{fig:defer:RCU Read-Side Using Per-Thread Reference-Count Pair and Sh
 with \co{rcu_idx} now being a \co{long} instead of an
 \co{atomic_t}.
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 static void flip_counter_and_wait(int ctr)
@@ -1092,7 +1093,6 @@ with \co{rcu_idx} now being a \co{long} instead of an
  37 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Shared Update Using Per-Thread Reference-Count Pair}
@@ -1204,6 +1204,7 @@ thread-local accesses to one, as is done in the next section.
 \subsubsection{RCU Based on Free-Running Counter}
 \label{defer:RCU Based on Free-Running Counter}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 DEFINE_SPINLOCK(rcu_gp_lock);
@@ -1212,13 +1213,13 @@ thread-local accesses to one, as is done in the next section.
   4 DEFINE_PER_THREAD(long, rcu_reader_gp_snap);
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{Data for Free-Running Counter Using RCU}
 \label{fig:defer:Data for Free-Running Counter Using RCU}
 \end{figure}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
  1 static void rcu_read_lock(void)
@@ -1255,7 +1256,6 @@ thread-local accesses to one, as is done in the next section.
 32 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{Free-Running Counter Using RCU}
@@ -1394,6 +1394,7 @@ variables.
 \subsubsection{Nestable RCU Based on Free-Running Counter}
 \label{defer:Nestable RCU Based on Free-Running Counter}
 
+\begin{figure}[tb]
 { \scriptsize
 \begin{verbbox}
   1 DEFINE_SPINLOCK(rcu_gp_lock);
@@ -1404,13 +1405,13 @@ variables.
   6 DEFINE_PER_THREAD(long, rcu_reader_gp);
 \end{verbbox}
 }
-\begin{figure}[tb]
 \centering
 \theverbbox
 \caption{Data for Nestable RCU Using a Free-Running Counter}
 \label{fig:defer:Data for Nestable RCU Using a Free-Running Counter}
 \end{figure}
 
+\begin{figure}[tb]
 { \scriptsize
 \begin{verbbox}
  1 static void rcu_read_lock(void)
@@ -1456,7 +1457,6 @@ variables.
 41 }
 \end{verbbox}
 }
-\begin{figure}[tb]
 \centering
 \theverbbox
 \caption{Nestable RCU Using a Free-Running Counter}
@@ -1677,6 +1677,7 @@ overhead.
 \subsubsection{RCU Based on Quiescent States}
 \label{defer:RCU Based on Quiescent States}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 DEFINE_SPINLOCK(rcu_gp_lock);
@@ -1684,13 +1685,13 @@ overhead.
   3 DEFINE_PER_THREAD(long, rcu_reader_qs_gp);
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{Data for Quiescent-State-Based RCU}
 \label{fig:defer:Data for Quiescent-State-Based RCU}
 \end{figure}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 static void rcu_read_lock(void)
@@ -1723,7 +1724,6 @@ overhead.
  28 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{Quiescent-State-Based RCU Read Side}
@@ -1830,6 +1830,7 @@ The \co{rcu_thread_online()} function simply invokes
 \co{rcu_quiescent_state()}, thus marking the end of the extended
 quiescent state.
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 void synchronize_rcu(void)
@@ -1852,7 +1853,6 @@ quiescent state.
  18 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Update Side Using Quiescent States}
Signature · 1 line
1.9.1
#7 lore raw

Re: [RFC PATCH] toyrcu: Enclose 'verbbox' within 'figure'

Quoted 10 lines · Akira Yokosawa
Quoted 1 line

From 1cbac7a606ed336367529414512d84005f92bf1f Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sun, 11 Sep 2016 11:33:33 +0900
Subject: [RFC PATCH] toyrcu: Enclose 'verbbox' within 'figure'

Bare "verbbox" environment just after a section heading causes the "afterheading"-ness of the first paragraph.
By enclosing the "verbbox" by a "figure" environment, we can avoid the side-effect.

Quoted 4 lines

This commit does the enclosing by moving \begin{figure} ahead of \begin{verbbox}.

Much better! Applied, thank you!

Thanx, Paul

Quoted 325 lines
---
 defer/toyrcu.tex | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
defer/toyrcu.tex +20 -20
index cd334ed..3b5a85c 100644
@@ -33,6 +33,7 @@ provides a summary and a list of desirable RCU properties.
 \subsubsection{Lock-Based RCU}
 \label{defer:Lock-Based RCU}
 
+\begin{figure}[bp]
 { \scriptsize
 \begin{verbbox}
   1 static void rcu_read_lock(void)
@@ -52,7 +53,6 @@ provides a summary and a list of desirable RCU properties.
  15 }
 \end{verbbox}
 }
-\begin{figure}[bp]
 \centering
 \theverbbox
 \caption{Lock-Based RCU Implementation}
@@ -92,6 +92,7 @@ preventing grace-period sharing.
 	also be a deadlock in any other RCU implementation?
 \QuickQuizAnswer{
 %
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 void foo(void)
@@ -115,7 +116,6 @@ preventing grace-period sharing.
  19 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{Deadlock in Lock-Based RCU Implementation}
@@ -171,6 +171,7 @@ in the next section.
 \subsubsection{Per-Thread Lock-Based RCU}
 \label{defer:Per-Thread Lock-Based RCU}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 static void rcu_read_lock(void)
@@ -194,7 +195,6 @@ in the next section.
  19 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{Per-Thread Lock-Based RCU Implementation}
@@ -291,6 +291,7 @@ the shortcomings of the lock-based implementation.
 \subsubsection{Simple Counter-Based RCU}
 \label{defer:Simple Counter-Based RCU}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 atomic_t rcu_refcnt;
@@ -317,7 +318,6 @@ the shortcomings of the lock-based implementation.
  22 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Implementation Using Single Global Reference Counter}
@@ -437,6 +437,7 @@ scheme that is more favorable to writers.
 \subsubsection{Starvation-Free Counter-Based RCU}
 \label{defer:Starvation-Free Counter-Based RCU}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 DEFINE_SPINLOCK(rcu_gp_lock);
@@ -446,13 +447,13 @@ scheme that is more favorable to writers.
   5 DEFINE_PER_THREAD(int, rcu_read_idx);
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Global Reference-Count Pair Data}
 \label{fig:defer:RCU Global Reference-Count Pair Data}
 \end{figure}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 static void rcu_read_lock(void)
@@ -485,7 +486,6 @@ scheme that is more favorable to writers.
  28 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Read-Side Using Global Reference-Count Pair}
@@ -579,6 +579,7 @@ the selected element of \co{rcu_refcnt}.
 Regardless of the nesting level, line~27 decrements this thread's
 instance of \co{rcu_nesting}.
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 void synchronize_rcu(void)
@@ -604,7 +605,6 @@ instance of \co{rcu_nesting}.
  21 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Update Using Global Reference-Count Pair}
@@ -771,6 +771,7 @@ scheme that provides greatly improved read-side performance and scalability.
 \subsubsection{Scalable Counter-Based RCU}
 \label{defer:Scalable Counter-Based RCU}
 
+\begin{figure}[tb]
 { \scriptsize
 \begin{verbbox}
   1 DEFINE_SPINLOCK(rcu_gp_lock);
@@ -780,13 +781,13 @@ scheme that provides greatly improved read-side performance and scalability.
   5 DEFINE_PER_THREAD(int, rcu_read_idx);
 \end{verbbox}
 }
-\begin{figure}[tb]
 \centering
 \theverbbox
 \caption{RCU Per-Thread Reference-Count Pair Data}
 \label{fig:defer:RCU Per-Thread Reference-Count Pair Data}
 \end{figure}
 
+\begin{figure}[tb]
 { \scriptsize
 \begin{verbbox}
   1 static void rcu_read_lock(void)
@@ -819,7 +820,6 @@ scheme that provides greatly improved read-side performance and scalability.
  28 }
 \end{verbbox}
 }
-\begin{figure}[tb]
 \centering
 \theverbbox
 \caption{RCU Read-Side Using Per-Thread Reference-Count Pair}
@@ -859,6 +859,7 @@ perform atomic operations.
 	But thankfully, it seems that no one runs Linux on 8-bit systems.
 } \QuickQuizEnd
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 static void flip_counter_and_wait(int i)
@@ -889,7 +890,6 @@ perform atomic operations.
  26 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Update Using Per-Thread Reference-Count Pair}
@@ -978,6 +978,7 @@ concurrent RCU updates.
 \subsubsection{Scalable Counter-Based RCU With Shared Grace Periods}
 \label{defer:Scalable Counter-Based RCU With Shared Grace Periods}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 DEFINE_SPINLOCK(rcu_gp_lock);
@@ -987,13 +988,13 @@ concurrent RCU updates.
   5 DEFINE_PER_THREAD(int, rcu_read_idx);
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Read-Side Using Per-Thread Reference-Count Pair and Shared Update Data}
 \label{fig:defer:RCU Read-Side Using Per-Thread Reference-Count Pair and Shared Update Data}
 \end{figure}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 static void rcu_read_lock(void)
@@ -1026,7 +1027,6 @@ concurrent RCU updates.
  28 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Read-Side Using Per-Thread Reference-Count Pair and Shared Update}
@@ -1051,6 +1051,7 @@ Figure~\ref{fig:defer:RCU Read-Side Using Per-Thread Reference-Count Pair and Sh
 with \co{rcu_idx} now being a \co{long} instead of an
 \co{atomic_t}.
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 static void flip_counter_and_wait(int ctr)
@@ -1092,7 +1093,6 @@ with \co{rcu_idx} now being a \co{long} instead of an
  37 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Shared Update Using Per-Thread Reference-Count Pair}
@@ -1204,6 +1204,7 @@ thread-local accesses to one, as is done in the next section.
 \subsubsection{RCU Based on Free-Running Counter}
 \label{defer:RCU Based on Free-Running Counter}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 DEFINE_SPINLOCK(rcu_gp_lock);
@@ -1212,13 +1213,13 @@ thread-local accesses to one, as is done in the next section.
   4 DEFINE_PER_THREAD(long, rcu_reader_gp_snap);
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{Data for Free-Running Counter Using RCU}
 \label{fig:defer:Data for Free-Running Counter Using RCU}
 \end{figure}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
  1 static void rcu_read_lock(void)
@@ -1255,7 +1256,6 @@ thread-local accesses to one, as is done in the next section.
 32 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{Free-Running Counter Using RCU}
@@ -1394,6 +1394,7 @@ variables.
 \subsubsection{Nestable RCU Based on Free-Running Counter}
 \label{defer:Nestable RCU Based on Free-Running Counter}
 
+\begin{figure}[tb]
 { \scriptsize
 \begin{verbbox}
   1 DEFINE_SPINLOCK(rcu_gp_lock);
@@ -1404,13 +1405,13 @@ variables.
   6 DEFINE_PER_THREAD(long, rcu_reader_gp);
 \end{verbbox}
 }
-\begin{figure}[tb]
 \centering
 \theverbbox
 \caption{Data for Nestable RCU Using a Free-Running Counter}
 \label{fig:defer:Data for Nestable RCU Using a Free-Running Counter}
 \end{figure}
 
+\begin{figure}[tb]
 { \scriptsize
 \begin{verbbox}
  1 static void rcu_read_lock(void)
@@ -1456,7 +1457,6 @@ variables.
 41 }
 \end{verbbox}
 }
-\begin{figure}[tb]
 \centering
 \theverbbox
 \caption{Nestable RCU Using a Free-Running Counter}
@@ -1677,6 +1677,7 @@ overhead.
 \subsubsection{RCU Based on Quiescent States}
 \label{defer:RCU Based on Quiescent States}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 DEFINE_SPINLOCK(rcu_gp_lock);
@@ -1684,13 +1685,13 @@ overhead.
   3 DEFINE_PER_THREAD(long, rcu_reader_qs_gp);
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{Data for Quiescent-State-Based RCU}
 \label{fig:defer:Data for Quiescent-State-Based RCU}
 \end{figure}
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 static void rcu_read_lock(void)
@@ -1723,7 +1724,6 @@ overhead.
  28 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{Quiescent-State-Based RCU Read Side}
@@ -1830,6 +1830,7 @@ The \co{rcu_thread_online()} function simply invokes
 \co{rcu_quiescent_state()}, thus marking the end of the extended
 quiescent state.
 
+\begin{figure}[tbp]
 { \scriptsize
 \begin{verbbox}
   1 void synchronize_rcu(void)
@@ -1852,7 +1853,6 @@ quiescent state.
  18 }
 \end{verbbox}
 }
-\begin{figure}[tbp]
 \centering
 \theverbbox
 \caption{RCU Update Side Using Quiescent States}
Signature · 1 line
1.9.1
#8 lore raw

Re: [RFC PATCH] toyrcu: Enclose 'verbbox' within 'figure'

Quoted 11 lines · Paul E. McKenney
Quoted 10 lines · Akira Yokosawa
Quoted 1 line

From 1cbac7a606ed336367529414512d84005f92bf1f Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Sun, 11 Sep 2016 11:33:33 +0900
Subject: [RFC PATCH] toyrcu: Enclose 'verbbox' within 'figure'

Bare "verbbox" environment just after a section heading causes the "afterheading"-ness of the first paragraph.
By enclosing the "verbbox" by a "figure" environment, we can avoid the side-effect.

Quoted 6 lines
Quoted 4 lines

This commit does the enclosing by moving \begin{figure} ahead of \begin{verbbox}.

Much better! Applied, thank you!

Thanks for applying this.
I'll do tree-wide modifications and submit them as a pull request. Before doing it, I've made a set of scripts to find modification candidate. I'm sending them as a patch. They can be used later to check if any wrong pattern of "verbbox" env might have sneaked in.

Thanks, Akira

Quoted 3 lines

Thanx, Paul