Skip to contentSkip to conversation

Remove \co{} commands in tables

PATCH Applied Akira Yokosawa 2 participants 19 messages Jan 4, 2017

lore
Share & tools
lore
#0 lore raw

cover Remove \co{} commands in tables

From d07bf0df57c597c22de9a7c159f10b0247cea8c2 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 4 Jan 2017 08:51:15 +0900
Subject: [PATCH 00/13] Remove \co{} commands in tables

\co{} command confuses column width estimation of tabular environment. By removing \co{} commands in tables, bogus "~"s for manual width adjustment can be removed.

Patch 1 introduces an alternative command \tco{} to be used in tables. Patches 2--8 remove \co{} commands by using \tco{} or removing unnecessary commands.
Patch 9 removes another "~" and uses \vspace{} instead.
Patches 10--13 do additional font tweaks. It looks better for me if headers of tables such as "Thread 1" and "CPU 1" are typeset in normal font of the text (Times Roman). Patch 13, which tweaks font of non-code words in table, may be an excessive tweak. Whether or not to apply it is up to the editor.

--
Akira Yokosawa (13):
Define \tco{} command to be used in table
rcufundamental: Rewrite table 'RCU Publish and Subscribe Primitives'
rcuapi: Rewrite table 'RCU Wait-to-Finish APIs'
rcuapi: Rewrite table 'RCU Publish-Subscribe and Version Maintenance
APIs'
whichtochoose: Rewrite table 'Which Deferred Technique to Choose?'
memorybarriers: Remove \co{} in tabular env
memorybarriers: Use \verb in table 'Lock-Based Critical Sections'
whymemorybarriers: Remove \co{} in tabular env
memorybarriers: Replace nbsp with \vspace
Add \nf{} command to go back to normal font
memorybarriers: Add \nf{} command to table header
whymemorybarriers: Add \nf{} command to table header
memorybarriers: Add \nf{} command to descriptive words in table

 advsync/memorybarriers.tex           | 187 +++++++++++++++++------------------
 appendix/whymb/whymemorybarriers.tex |  70 ++++++-------
 defer/rcuapi.tex                     | 110 +++++++++------------
 defer/rcufundamental.tex             |  18 ++--
 defer/whichtochoose.tex              |  20 ++--
 perfbook.tex                         |   6 +-
 6 files changed, 200 insertions(+), 211 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/13 Define \tco{} command to be used in table

From 6ccc6c3ca1d324ff09b79fc955eed07b13a4575c Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 31 Dec 2016 13:01:28 +0900
Subject: [PATCH 01/13] Define \tco{} command to be used in table

The \co{} command interferes with column width estimation of tabular environment. To avoid the issue, this commit defines a command "\tco{}" to be used instead. It will still break at white spaces, but not at "_".
This commit also updates the definition of \nbco{} to make sure that it won't break at "_".

---
 perfbook.tex | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
perfbook.tex +4 -1
index 2942a3f..4eaace8 100644
@@ -94,7 +94,10 @@
 \makeatother
 % ---  End of workaround for Fedora 23 Texlive bug
 \newcommand{\co}[1]{\lstinline[breaklines=true,breakatwhitespace=true]{#1}}
-\newcommand{\nbco}[1]{\lstinline[breaklines=false,breakatwhitespace=false]{#1}}
+\newcommand{\nbco}[1]{\hbox{\texttt{\detokenize{#1}}}} % no break lines for short snippet
+\newcommand{\tco}[1]{\texttt{\detokenize{#1}}} % for code in tabular environment
+% \tco{} will break at spaces but not at underscores
+
 \newcommand{\Epigraph}[2]{\epigraphhead[65]{\rmfamily\epigraph{#1}{#2}}}
 
 \title{Is Parallel Programming Hard, And, If So, What Can You Do About It?}
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/13 rcufundamental: Rewrite table 'RCU Publish and Subscribe Primitives'

In reply to Akira Yokosawa

From 5644ba4f62ce26df9c531e72f2a6a630ae80ce5c Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 31 Dec 2016 13:13:18 +0900
Subject: [PATCH 02/13] rcufundamental: Rewrite table 'RCU Publish and Subscribe Primitives'

By using \tco{}, this commit removes bogus "~"s. It also tweaks layout options of parboxes for better looks.

---
 defer/rcufundamental.tex | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
defer/rcufundamental.tex +9 -9
index 0c97b8c..11d8d55 100644
@@ -386,24 +386,24 @@ circular list:
 Category  & Publish	& Retract	& Subscribe \\
 \hline
 \hline
-Pointers  & \co{rcu_assign_pointer()}
-			& \co{rcu_assign_pointer(..., NULL)}~~
-					& \co{rcu_dereference()} \\
+Pointers  & \tco{rcu_assign_pointer()}
+			& \tco{rcu_assign_pointer(..., NULL)}
+					& \tco{rcu_dereference()} \\
 \hline
-Lists     & \parbox{1.5in}{
+Lists     & \parbox[c][0.37in][c]{1.3in}{
 		\co{list_add_rcu()} \\
 		\co{list_add_tail_rcu()} \\
 		\co{list_replace_rcu()} }
-			& \co{list_del_rcu()}
-					& \co{list_for_each_entry_rcu()}~~~ \\
+			& \tco{list_del_rcu()}
+					& \tco{list_for_each_entry_rcu()} \\
 \hline
-Hlists    & \parbox{1.5in}{
+Hlists    & \parbox[c][0.5in][c]{1.3in}{
 		\co{hlist_add_after_rcu()} \\
 		\co{hlist_add_before_rcu()}  \\
 		\co{hlist_add_head_rcu()} \\
 		\co{hlist_replace_rcu()} }
-			& \co{hlist_del_rcu()}
-					& \co{hlist_for_each_entry_rcu()}~~~~~
+			& \tco{hlist_del_rcu()}
+					& \tco{hlist_for_each_entry_rcu()}
 \end{tabular}
 \caption{RCU Publish and Subscribe Primitives}
 \label{tab:defer:RCU Publish and Subscribe Primitives}
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/13 rcuapi: Rewrite table 'RCU Wait-to-Finish APIs'

In reply to Akira Yokosawa

From 3081eb38520f7e9415758f40ec4a26bb17bffbc0 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 31 Dec 2016 13:53:15 +0900
Subject: [PATCH 03/13] rcuapi: Rewrite table 'RCU Wait-to-Finish APIs'

By using \tco{}, protection by minipages is not necessary anymore. Now, features of "tabulary" can be fully utilized. Parameters of the environment are tweaked somewhat.

---
 defer/rcuapi.tex | 67 +++++++++++++++++++++++---------------------------------
 1 file changed, 28 insertions(+), 39 deletions(-)
defer/rcuapi.tex +28 -39
index 830019e..8a678f6 100644
@@ -18,8 +18,8 @@ presents concluding remarks.
 
 \begin{sidewaystable*}[htbp]
 \centering
-\scriptsize\tymin=1.4in
-\begin{tabulary}{7.8in}{L|L|L|L|L|L}
+\scriptsize\tymin=1.0in
+\begin{tabulary}{7.6in}{L|L|L|L|L|L}
 Attribute &
     RCU Classic &
 	RCU BH &
@@ -43,49 +43,38 @@ Availability &
 		    2.6.19 \\
 \hline
 Read-side primitives &
-    \begin{minipage}[t]{1.4in}{ \raggedright
-      \co{rcu_read_lock()}~! \\
-      \co{rcu_read_unlock()}~! }\end{minipage} &
-	\begin{minipage}[t]{1.4in}{ \raggedright
-	  \co{rcu_read_lock_bh()} \\
-	  \co{rcu_read_unlock_bh()} }\end{minipage} &
-	    \begin{minipage}[t]{1.4in}{ \raggedright
-	      \co{preempt_disable()} \\
-	      \co{preempt_enable()} \\
-	      (and friends) }\end{minipage} &
-	        \begin{minipage}[t]{1.4in}{ \raggedright
-		  \co{rcu_read_lock()} \\
-		  \co{rcu_read_unlock()} }\end{minipage} &
-		    \begin{minipage}[t]{1.4in}{ \raggedright
-		      \co{srcu_read_lock()} \\
-		      \co{srcu_read_unlock()} }\end{minipage} \\
+    \tco{rcu_read_lock()}~! \tco{rcu_read_unlock()}~! &
+	\tco{rcu_read_lock_bh()} \tco{rcu_read_unlock_bh()} &
+	    \tco{preempt_disable()} \tco{preempt_enable()} (and friends) &
+	        \tco{rcu_read_lock()} \tco{rcu_read_unlock()} &
+		    \tco{srcu_read_lock()} \tco{srcu_read_unlock()} \\
 \hline
 { Update-side primitives (synchronous) } &
-    { \co{synchronize_rcu()} \co{synchronize_net()} } &
-	\co{synchronize_rcu_bh()} &
-	    \co{synchronize_sched()} &
-	        { \co{synchronize_rcu()} \co{synchronize_net()} } &
-		    \co{synchronize_srcu()} \\
+    { \tco{synchronize_rcu()} \tco{synchronize_net()} } &
+	\tco{synchronize_rcu_bh()} &
+	    \tco{synchronize_sched()} &
+	        { \tco{synchronize_rcu()} \tco{synchronize_net()} } &
+		    \tco{synchronize_srcu()} \\
 \hline
 { Update-side primitives (asynchronous/callback) } &
-    \co{call_rcu()} ! &
-	\co{call_rcu_bh()} &
-	    \co{call_rcu_sched()} &
-	        \co{call_rcu()} &
-		    \co{call_srcu()} \\
+    \tco{call_rcu()} ! &
+	\tco{call_rcu_bh()} &
+	    \tco{call_rcu_sched()} &
+	        \tco{call_rcu()} &
+		    \tco{call_srcu()} \\
 \hline
 { Update-side primitives (wait for callbacks) } &
-    \co{rcu_barrier()} &
-	\co{rcu_barrier_bh()} &
-	    \co{rcu_barrier_sched()} &
-	        \co{rcu_barrier()} &
+    \tco{rcu_barrier()} &
+	\tco{rcu_barrier_bh()} &
+	    \tco{rcu_barrier_sched()} &
+	        \tco{rcu_barrier()} &
 		    N/A \\
 \hline
 Type-safe memory &
-    \co{SLAB_DESTROY_BY_RCU} &
+    \tco{SLAB_DESTROY_BY_RCU} &
 	&
 	    &
-	        \co{SLAB_DESTROY_BY_RCU} &
+	        \tco{SLAB_DESTROY_BY_RCU} &
 		    \\
 \hline
 Read side constraints &
@@ -93,12 +82,12 @@ Read side constraints &
 	No bottom-half (BH) enabling &
 	    No blocking &
 	        Only preemption and lock acquisition &
-		    No \co{synchronize_srcu()} with same \co{srcu_struct} \\
+		    No \tco{synchronize_srcu()} with same \tco{srcu_struct} \\
 \hline
 Read side overhead &
-    Preempt disable/enable (free on non-PREEMPT) &
+    Preempt disable/enable (free on non-\tco{PREEMPT}) &
 	BH disable/enable &
-	    Preempt disable/enable (free on non-PREEMPT) &
+	    Preempt disable/enable (free on non-\tco{PREEMPT}) &
 	        Simple instructions, irq disable/enable &
 		    Simple instructions, preempt disable/enable, memory barriers \\
 \hline
@@ -116,14 +105,14 @@ Grace-period latency &
 	        10s of milliseconds &
 		    10s of milliseconds \\
 \hline
-Non-\co{PREEMPT_RT} implementation &
+Non-\tco{PREEMPT_RT} implementation &
     RCU Classic &
 	RCU BH &
 	    RCU Classic &
 	        Preemptible RCU &
 		    SRCU \\
 \hline
-\co{PREEMPT_RT} implementation &
+\tco{PREEMPT_RT} implementation &
     Preemptible RCU &
 	Realtime RCU &
 	    Forced Schedule on all CPUs &
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/13 rcuapi: Rewrite table 'RCU Publish-Subscribe and Version Maintenance APIs'

In reply to Akira Yokosawa

From 5c513c2e5b0b9978093475d91cc55c634002aa84 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 31 Dec 2016 15:56:01 +0900
Subject: [PATCH 04/13] rcuapi: Rewrite table 'RCU Publish-Subscribe and Version Maintenance APIs'

By using \tco{} command, this table can be easily expressed in normal tabular environment.

---
 defer/rcuapi.tex | 43 ++++++++++++++++++++-----------------------
 1 file changed, 20 insertions(+), 23 deletions(-)
defer/rcuapi.tex +20 -23
index 8a678f6..f2aa3ff 100644
@@ -456,8 +456,8 @@ that Linux supports~\cite{Spraul01}.
 
 \begin{table*}[tb]
 \footnotesize
-\centering\tymin=1.0in\tymax=1.6in
-\begin{tabulary}{5in}{l|L|l|L}
+\centering
+\begin{tabular}{l|l|l|p{1.2in}}
 Category &
 	Primitives &
 		Availability &
@@ -465,69 +465,66 @@ Category &
 \hline
 \hline
 List traversal &
-	\co{list_for_each_entry_rcu()} &
+	\tco{list_for_each_entry_rcu()} &
 		2.5.59 &
-			{ \raggedright
-			  Simple instructions (memory barrier on Alpha) } \\
+			Simple instructions (memory barrier on Alpha) \\
 \hline
 List update &
-	\co{list_add_rcu()} &
+	\tco{list_add_rcu()} &
 		2.5.44 &
 			Memory barrier \\
 &
-	\co{list_add_tail_rcu()} &
+	\tco{list_add_tail_rcu()} &
 		2.5.44 &
 			Memory barrier \\
 &
-	\co{list_del_rcu()} &
+	\tco{list_del_rcu()} &
 		2.5.44 &
 			Simple instructions \\
 &
-	\co{list_replace_rcu()} &
+	\tco{list_replace_rcu()} &
 		2.6.9 &
 			Memory barrier \\
 &
-	\co{list_splice_init_rcu()} &
+	\tco{list_splice_init_rcu()} &
 		2.6.21 &
 			Grace-period latency \\
 \hline
 Hlist traversal &
-	\co{hlist_for_each_entry_rcu()} &
+	\tco{hlist_for_each_entry_rcu()} &
 		2.6.8 &
-			{ \raggedright
-			  Simple instructions (memory barrier on Alpha) } \\
+			Simple instructions (memory barrier on Alpha) \\
 &
-	\co{hlist_add_after_rcu()} &
+	\tco{hlist_add_after_rcu()} &
 		2.6.14 &
 			Memory barrier \\
 &
-	\co{hlist_add_before_rcu()} &
+	\tco{hlist_add_before_rcu()} &
 		2.6.14 &
 			Memory barrier \\
 &
-	\co{hlist_add_head_rcu()} &
+	\tco{hlist_add_head_rcu()} &
 		2.5.64 &
 			Memory barrier \\
 &
-	\co{hlist_del_rcu()} &
+	\tco{hlist_del_rcu()} &
 		2.5.64 &
 			Simple instructions \\
 &
-	\co{hlist_replace_rcu()} &
+	\tco{hlist_replace_rcu()} &
 		2.6.15 &
 			Memory barrier \\
 \hline
 Pointer traversal &
-	\co{rcu_dereference()} &
+	\tco{rcu_dereference()} &
 		2.6.9 &
-			{ \raggedright
-			  Simple instructions (memory barrier on Alpha) } \\
+			Simple instructions (memory barrier on Alpha) \\
 \hline
 Pointer update &
-	\co{rcu_assign_pointer()} &
+	\tco{rcu_assign_pointer()} &
 		2.6.10 &
 			Memory barrier \\
-\end{tabulary}
+\end{tabular}
 \caption{RCU Publish-Subscribe and Version Maintenance APIs}
 \label{tab:defer:RCU Publish-Subscribe and Version Maintenance APIs}
 \end{table*}
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/13 whichtochoose: Rewrite table 'Which Deferred Technique to Choose?'

In reply to Akira Yokosawa

From 62c8c8b8060cc50f2c17e626723b801def90b29e Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 31 Dec 2016 15:57:59 +0900
Subject: [PATCH 05/13] whichtochoose: Rewrite table 'Which Deferred Technique to Choose?'

By using \tco{} command, this table can be more easily expressed in "tabulary" environment. This commit also removes bogus "~"s and reduces font size to footnotesize. It also appends short cut command of extdash to compound words.

---
 defer/whichtochoose.tex | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
defer/whichtochoose.tex +10 -10
index 11f3b0a..cf21341 100644
@@ -5,10 +5,10 @@
 \label{sec:defer:Which to Choose?}
 
 \begin{table*}
-\small
-\centering
-\begin{tabular}{p{1.5in}||p{1.5in}|p{0.8in}|p{0.8in}|p{1.0in}}
-	~ ~ ~ ~ ~ ~ ~ ~ ~
+\footnotesize
+\centering\tymin=0.4in\tymax=2in
+\begin{tabulary}{5.3in}{L||L|L|L|L}
+
 		& Reference Counting
 			& Hazard Pointers
 				& Sequence Locks
@@ -34,17 +34,17 @@
 				& None
 					& None \\
 	\hline
-	Reader Per-Critical-Section Overhead
+	Reader Per\-/Critical\-/Section Overhead
 		& N/A
 			& N/A
-				& Two \co{smp_mb()}
+				& Two \tco{smp_mb()}
 					& Ranges from none to two
-					  \co{smp_mb()} \\
+					  \tco{smp_mb()} \\
 	\hline
 	Reader Per-Object Traversal Overhead
-		& Read-modify-write atomic operations, memory-barrier
+		& Read-modify-write atomic operations, memory\-/barrier
 		  instructions, and cache misses
-			& \co{smp_mb()}
+			& \tco{smp_mb()}
 				& None, but unsafe
 					& None (volatile accesses) \\
 	\hline
@@ -83,7 +83,7 @@
 			& 79
 				& 79
 					& 73 \\
-\end{tabular}
+\end{tabulary}
 \caption{Which Deferred Technique to Choose?}
 \label{tab:defer:Which Deferred Technique to Choose?}
 \end{table*}
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/13 memorybarriers: Remove \co{} in tabular env

In reply to Akira Yokosawa

From 0c2deaa9675059d632aed04cfbd6f9f86f045720 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sun, 1 Jan 2017 13:41:04 +0900
Subject: [PATCH 06/13] memorybarriers: Remove \co{} in tabular env

Not just replacing \co{}s, this commit removes unnecessary commands which are already in typewriter font. It also proactively uses escapes by "\" for a single "_" in API.

---
 advsync/memorybarriers.tex | 109 ++++++++++++++++++++++-----------------------
 1 file changed, 54 insertions(+), 55 deletions(-)
advsync/memorybarriers.tex +54 -55
index b8bc611..100b67d 100644
@@ -13,15 +13,15 @@ use of standard mutual-exclusion mechanisms, such as locking and
 RCU.
 
 \begin{table}
-\centering
+\centering{\tt
 \begin{tabular}{l|l}
 	Thread 1 & Thread 2 \\
 	\hline
-	\co{x = 1;} & \co{y = 1;} \\
-	\co{r1 = y;} & \co{r2 = x;} \\
+	x = 1;  & y = 1; \\
+	r1 = y; & r2 = x; \\
 	\hline
-	\multicolumn{2}{l}{\co{assert(r1 == 1 || r2 == 1);}} \\
-\end{tabular}
+	\multicolumn{2}{l}{assert(r1 == 1 || r2 == 1);} \\
+\end{tabular}}
 \caption{Memory Misordering: Dekker}
 \label{tab:advsync:Memory Misordering: Dekker}
 \end{table}
@@ -522,9 +522,9 @@ on this weaker if-then conditional ordering guarantee.
 \begin{tabular}{l|l}
 	CPU 1 &			CPU 2 \\
 	\hline
-	\co{access(A);} &	\co{access(B);} \\
-	\co{smp_mb();} &	\co{smp_mb();} \\
-	\co{access(B);} &	\co{access(A);} \\
+	access(A);	&	access(B); \\
+	smp\_mb();	&	smp\_mb(); \\
+	access(B);	&	access(A); \\
 \end{tabular}
 \end{minipage}
 \vspace{5pt}
@@ -617,9 +617,9 @@ pairings that portable software may depend on.
 	\begin{tabular}{l|l}
 		CPU 1 &			CPU 2 \\
 		\hline
-		\co{A=1;} &		\co{Y=B;} \\
-		\co{smp_mb();} &	\co{smp_mb();} \\
-		\co{B=1;} &		\co{X=A;} \\
+		A=1;		&	Y=B; \\
+		smp\_mb();	&	smp\_mb(); \\
+		B=1;		&	X=A; \\
 	\end{tabular}
 	\end{minipage}
 	\vspace{5pt}
@@ -649,9 +649,9 @@ pairings that portable software may depend on.
 	\begin{tabular}{l|l}
 		CPU 1 &			CPU 2 \\
 		\hline
-		\co{X=A;} &		\co{Y=B;} \\
-		\co{smp_mb();} &	\co{smp_mb();} \\
-		\co{B=1;} &		\co{A=1;} \\
+		X=A;            &	Y=B; \\
+		smp\_mb();	&	smp\_mb(); \\
+		B=1;            &	A=1; \\
 	\end{tabular}
 	\end{minipage}
 	\vspace{5pt}
@@ -686,9 +686,9 @@ pairings that portable software may depend on.
 	\begin{tabular}{l|l}
 		CPU 1 &			CPU 2 \\
 		\hline
-		\co{X=A;} &		\co{B=2;} \\
-		\co{smp_mb();} &	\co{smp_mb();} \\
-		\co{B=1;} &		\co{A=1;} \\
+		X=A;		&	B=2; \\
+		smp\_mb();	&	smp\_mb(); \\
+		B=1;		&	A=1; \\
 	\end{tabular}
 	\end{minipage}
 	\vspace{5pt}
@@ -767,9 +767,9 @@ keep in mind that they used to be a \emph{lot} harder on some systems!
 	\begin{tabular}{l|l}
 		CPU 1 &			CPU 2 \\
 		\hline
-		\co{A=1;} &		\co{B=2;} \\
-		\co{smp_mb();} &	\co{smp_mb();} \\
-		\co{B=1;} &		\co{A=2;} \\
+		A=1;		&	B=2; \\
+		smp\_mb();	&	smp\_mb(); \\
+		B=1;		&	A=2; \\
 	\end{tabular}
 	\end{minipage}
 	\vspace{5pt}
@@ -1049,17 +1049,16 @@ the sequence of operations might be as follows:
 \vspace{5pt}
 \begin{minipage}[t]{\columnwidth}
 \tt \scriptsize
-\scriptsize
 \begin{tabular}{l|l}
 	CPU 1 &			CPU 2 \\
 	\hline
-	(critical section) &	\co{atomic_xchg(&lck->a, 1)->1} \\
-	\co{smp_mb();} &	\co{lck->a->1} \\
-	\co{lck->a=0;} &	\co{lck->a->1} \\
-	&			\co{lck->a->0} \\
-	&			(implicit \co{smp_mb()} 1) \\
-	&			\co{atomic_xchg(&lck->a, 1)->0} \\
-	&			(implicit \co{smp_mb()} 2) \\
+	(critical section) &	\tco{atomic_xchg(&lck->a, 1)->1} \\
+	\tco{smp_mb();}    &	lck->a->1 \\
+	lck->a=0;	   &	lck->a->1 \\
+	&			lck->a->0 \\
+	&			(implicit \tco{smp_mb()} 1) \\
+	&			\tco{atomic_xchg(&lck->a, 1)->0} \\
+	&			(implicit \tco{smp_mb()} 2) \\
 	&			(critical section) \\
 \end{tabular}
 \end{minipage}
@@ -2077,14 +2076,14 @@ This is demonstrated by two related examples, with the initial values of
 \begin{tabular}{l|p{1.5in}}
 	CPU 0 &		CPU 1 \\
 	\hline
-	\co{r1 = READ_ONCE(x);} &
-		\co{r2 = READ_ONCE(y);} \\
-	\co{if (r1 > 0)} &
-		\co{if (r2 > 0)} \\
-	~~~\co{WRITE_ONCE(y, 1);} &
-		~~~\co{WRITE_ONCE(x, 1);} \\
+	r1 = READ\_ONCE(x); &
+		r2 = READ\_ONCE(y); \\
+	if (r1 > 0) &
+		if (r2 > 0) \\
+	~~~WRITE\_ONCE(y, 1); &
+		~~~WRITE\_ONCE(x, 1); \\
 	\multicolumn{2}{l}{~} \\
-	\multicolumn{2}{l}{\co{assert(!(r1 == 1 && r2 == 1));}} \\
+	\multicolumn{2}{l}{\tco{assert(!(r1 == 1 && r2 == 1));}} \\
 \end{tabular}
 \end{minipage}
 \vspace{5pt}
@@ -2100,9 +2099,9 @@ not), then adding the following CPU would guarantee a related assertion:
 \begin{tabular}{l}
 	CPU 2 \\
 	\hline
-	\co{WRITE_ONCE(y, 1);} \\
+	WRITE\_ONCE(y, 1); \\
 	\multicolumn{1}{l}{~} \\
-	\multicolumn{1}{l}{\co{assert(!(r1 == 1 && r2 == 1 && x == 1));}} \\
+	\multicolumn{1}{l}{\tco{assert(!(r1 == 1 && r2 == 1 && x == 1));}} \\
 \end{tabular}
 \end{minipage}
 \vspace{5pt}
@@ -2744,17 +2743,17 @@ Table~\ref{tab:advsync:Ordering With Multiple Locks}, which uses
 a pair of locks named ``M'' and ``Q''.
 
 \begin{table}[htbp]
-\scriptsize\centering
+\scriptsize\centering{\tt
 \begin{tabular}{r|l}
-  \co{CPU 1}     & \co{CPU 2} \\
+  CPU 1 &	CPU 2 \\
   \hline
-  \co{A = a;}    & \co{E = e;} \\
-  \co{LOCK M;}   & \co{LOCK Q;} \\
-  \co{B = b;}    & \co{F = f;} \\
-  \co{C = c;}    & \co{G = g;} \\
-  \co{UNLOCK M;} & \co{UNLOCK Q;} \\
-  \co{D = d;}    & \co{H = h;} \\
-\end{tabular}
+  A = a; &	E = e; \\
+  LOCK M; &	LOCK Q; \\
+  B = b; &	F = f; \\
+  C = c; &	G = g; \\
+  UNLOCK M; &	UNLOCK Q; \\
+  D = d; &	H = h; \\
+\end{tabular}}
 \caption{Ordering With Multiple Locks}
 \label{tab:advsync:Ordering With Multiple Locks}
 \end{table}
@@ -2784,17 +2783,17 @@ the same lock, as shown in
 Table~\ref{tab:advsync:Ordering With Multiple CPUs on One Lock}?
 
 \begin{table}[htbp]
-\scriptsize\centering
+\scriptsize\centering{\tt
 \begin{tabular}{r|l}
-  \co{CPU 1}     & \co{CPU 2} \\
+  CPU 1 &	CPU 2 \\
   \hline
-  \co{A = a;}    & \co{E = e;} \\
-  \co{LOCK M;}   & \co{LOCK M;} \\
-  \co{B = b;}    & \co{F = f;} \\
-  \co{C = c;}    & \co{G = g;} \\
-  \co{UNLOCK M;} & \co{UNLOCK M;} \\
-  \co{D = d;}    & \co{H = h;} \\
-\end{tabular}
+  A = a; &	E = e; \\
+  LOCK M; &	LOCK M; \\
+  B = b; &	F = f; \\
+  C = c; &	G = g; \\
+  UNLOCK M; &	UNLOCK M; \\
+  D = d; &	H = h; \\
+\end{tabular}}
 \caption{Ordering With Multiple CPUs on One Lock}
 \label{tab:advsync:Ordering With Multiple CPUs on One Lock}
 \end{table}
Signature · 1 line
2.7.4
#7 lore raw

PATCH 7/13 memorybarriers: Use \verb in table 'Lock-Based Critical Sections'

In reply to Akira Yokosawa

From 63d69c9948baaf52f8dffb76f86f308b05050118 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 31 Dec 2016 17:53:35 +0900
Subject: [PATCH 07/13] memorybarriers: Use \verb in table 'Lock-Based Critical Sections'

In this case, using \verb makes your life simpler.

---
 advsync/memorybarriers.tex | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
advsync/memorybarriers.tex +9 -9
index 100b67d..6291097 100644
@@ -2685,23 +2685,23 @@ operations concurrently:
   \# & Ordering: legitimate or not? \\
   \hline
   \hline
-  1 & \co{*A; *B; LOCK; *C; *D; UNLOCK; *E; *F;} \\
+  1 & \verb|*A; *B; LOCK; *C; *D; UNLOCK; *E; *F;| \\
   \hline
-  2 & \tt{*A; \{*B; LOCK;\} *C; *D; UNLOCK; *E; *F;} \\
+  2 & \verb|*A; {*B; LOCK;} *C; *D; UNLOCK; *E; *F;| \\
   \hline
-  3 & \tt{\{*F; *A;\} *B; LOCK; *C; *D; UNLOCK; *E;} \\
+  3 & \verb|{*F; *A;} *B; LOCK; *C; *D; UNLOCK; *E;| \\
   \hline
-  4 & \tt{*A; *B; \{LOCK; *C;\} *D; \{UNLOCK; *E;\} *F;} \\
+  4 & \verb|*A; *B; {LOCK; *C;} *D; {UNLOCK; *E;} *F;| \\
   \hline
-  5 & \co{*B; LOCK; *C; *D; *A; UNLOCK; *E; *F;} \\
+  5 & \verb|*B; LOCK; *C; *D; *A; UNLOCK; *E; *F;| \\
   \hline
-  6 & \co{*A; *B; *C; LOCK; *D; UNLOCK; *E; *F;} \\
+  6 & \verb|*A; *B; *C; LOCK; *D; UNLOCK; *E; *F;| \\
   \hline
-  7 & \co{*A; *B; LOCK; *C; UNLOCK; *D; *E; *F;} \\
+  7 & \verb|*A; *B; LOCK; *C; UNLOCK; *D; *E; *F;| \\
   \hline
-  8 & \tt{\{*B; *A; LOCK;\} \{*D; *C;\} \{UNLOCK; *F; *E;\}} \\
+  8 & \verb|{*B; *A; LOCK;} {*D; *C;} {UNLOCK; *F; *E;}| \\
   \hline
-  9 & \tt{*B; LOCK; *C; *D; UNLOCK; \{*F; *A;\} *E; } \\
+  9 & \verb|*B; LOCK; *C; *D; UNLOCK; {*F; *A;} *E;| \\
 \end{tabular}
 \caption{Lock-Based Critical Sections}
 \label{tab:advsync:Lock-Based Critical Sections}
Signature · 1 line
2.7.4
#8 lore raw

PATCH 8/13 whymemorybarriers: Remove \co{} in tabular env

In reply to Akira Yokosawa

From 7ca309f9799fd412cc4c09adcf98e46ec4aea61a Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Mon, 2 Jan 2017 08:44:33 +0900
Subject: [PATCH 08/13] whymemorybarriers: Remove \co{} in tabular env

By setting typewriter font as default, this commit removes \co{} commands. It also proactively uses escapes by "\" for a single "_" in API.

---
 appendix/whymb/whymemorybarriers.tex | 52 ++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 26 deletions(-)
appendix/whymb/whymemorybarriers.tex +26 -26
index 2b6fc97..f97160a 100644
@@ -1355,20 +1355,20 @@ Each of ``a'', ``b'', and ``c'' are initially zero.
 
 \begin{table*}
 \small
-\centering
+\centering{\tt
 \begin{tabular}{l|l|l}
 	\multicolumn{1}{c|}{CPU~0} &
 		\multicolumn{1}{c|}{CPU~1} &
 			\multicolumn{1}{c}{CPU~2} \\
 	\hline
 	\hline
-	\co{a = 1;}	 &		& \\
-	\co{smp_wmb();} & \co{while (b == 0)}; & \\
-	\co{b = 1;}	 & \co{c = 1;} & \co{z = c;} \\
-			 &		& \co{smp_rmb();} \\
-			 &		& \co{x = a;} \\
-			 &		& \co{assert(z == 0 || x == 1);} \\
-\end{tabular}
+	a = 1;		 &		& \\
+	smp\_wmb(); 	 & while (b == 0); & \\
+	b = 1;		 & c = 1;	& z = c; \\
+			 &		& smp\_rmb(); \\
+			 &		& x = a; \\
+			 &		& assert(z == 0 || x == 1); \\
+\end{tabular}}
 \caption{Memory Barrier Example 1}
 \label{tab:app:whymb:Memory Barrier Example 1}
 \end{table*}
@@ -1415,19 +1415,19 @@ Both ``a'' and ``b'' are initially zero.
 
 \begin{table*}
 \small
-\centering
+\centering{\tt
 \begin{tabular}{l|l|l}
 	\multicolumn{1}{c|}{CPU~0} &
 		\multicolumn{1}{c|}{CPU~1} &
 			\multicolumn{1}{c}{CPU~2} \\
 	\hline
 	\hline
-	\co{a = 1;} & \co{while (a == 0)}; & \\
-		     & \co{smp_mb();}	& \co{y = b;} \\
-		     & \co{b = 1;}	& \co{smp_rmb();} \\
-		     &			& \co{x = a;} \\
-		     &			& \co{assert(y == 0 || x == 1);} \\
-\end{tabular}
+	a = 1;	     & while (a == 0); & \\
+		     & smp\_mb();	& y = b; \\
+		     & b = 1;		& smp\_rmb(); \\
+		     &			& x = a; \\
+		     &			& assert(y == 0 || x == 1); \\
+\end{tabular}}
 \caption{Memory Barrier Example 2}
 \label{tab:app:whymb:Memory Barrier Example 2}
 \end{table*}
@@ -1457,23 +1457,23 @@ All variables are initially zero.
 
 \begin{table*}
 \scriptsize
-\centering
+\centering{\tt
 \begin{tabular}{r|l|l|l}
 	& \multicolumn{1}{c|}{CPU~0} &
 		\multicolumn{1}{c|}{CPU~1} &
 			\multicolumn{1}{c}{CPU~2} \\
 	\hline
 	\hline
- 1 &	\co{a = 1;} &			& \\
- 2 &	\co{smb_wmb();} &		& \\
- 3 &	\co{b = 1;} & \co{while (b == 0)}; & \co{while (b == 0)}; \\
- 4 &		     & \co{smp_mb();}	& \co{smp_mb();} \\
- 5 &		     & \co{c = 1;}	& \co{d = 1;} \\
- 6 &	\co{while (c == 0);} &		& \\
- 7 &	\co{while (d == 0);} &		& \\
- 8 &	\co{smp_mb();} &		& \\
- 9 &	\co{e = 1;} &			& \co{assert(e == 0 || a == 1);} \\
-\end{tabular}
+ 1 &	a = 1; &			& \\
+ 2 &	smb\_wmb();	&		& \\
+ 3 &	b = 1;		& while (b == 0); & while (b == 0); \\
+ 4 &			& smp\_mb();	& smp\_mb(); \\
+ 5 &			& c = 1;	& d = 1; \\
+ 6 &	while (c == 0); &		& \\
+ 7 &	while (d == 0); &		& \\
+ 8 &	smp\_mb();	&		& \\
+ 9 &	e = 1; &			& assert(e == 0 || a == 1); \\
+\end{tabular}}
 \caption{Memory Barrier Example 3}
 \label{tab:app:whymb:Memory Barrier Example 3}
 \end{table*}
Signature · 1 line
2.7.4
#9 lore raw

PATCH 9/13 memorybarriers: Replace nbsp with \vspace

In reply to Akira Yokosawa

From 7fb784f112a501b3fe189538b74f3a3b9f97ad99 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 31 Dec 2016 23:13:49 +0900
Subject: [PATCH 09/13] memorybarriers: Replace nbsp with \vspace

---
 advsync/memorybarriers.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
advsync/memorybarriers.tex +1 -1
index 6291097..3bf3a7f 100644
@@ -1160,7 +1160,7 @@ The set of accesses as seen by the memory system in the middle can be arranged
 in 24 different combinations, with loads denoted by ``ld'' and stores
 denoted by ``st'':
 
-~ \\
+\vspace{5pt}
 \begin{minipage}[t]{\columnwidth}
 \tt
 \scriptsize
Signature · 1 line
2.7.4
#10 lore raw

PATCH 10/13 Add \nf{} command to go back to normal font

In reply to Akira Yokosawa

From aac92885e4b76e4229fedc388e8539bc0f656153 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sat, 31 Dec 2016 19:00:00 +0900
Subject: [PATCH 10/13] Add \nf{} command to go back to normal font

This command will be used in tables whose base font is typewriter font. We should avoid \rm{} command in case sans serif font be selected as default.

---
 perfbook.tex | 1 +
 1 file changed, 1 insertion(+)
perfbook.tex +1 -0
index 4eaace8..bb1e47e 100644
@@ -97,6 +97,7 @@
 \newcommand{\nbco}[1]{\hbox{\texttt{\detokenize{#1}}}} % no break lines for short snippet
 \newcommand{\tco}[1]{\texttt{\detokenize{#1}}} % for code in tabular environment
 % \tco{} will break at spaces but not at underscores
+\newcommand{\nf}[1]{\textnormal{#1}} % to return to normal font
 
 \newcommand{\Epigraph}[2]{\epigraphhead[65]{\rmfamily\epigraph{#1}{#2}}}
 
Signature · 1 line
2.7.4
#11 lore raw

PATCH 11/13 memorybarriers: Add \nf{} command to table header

In reply to Akira Yokosawa

From f09bec66accb5e0340777fb4c2590f930ddd5aa6 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sun, 1 Jan 2017 13:57:17 +0900
Subject: [PATCH 11/13] memorybarriers: Add \nf{} command to table header

---
 advsync/memorybarriers.tex | 50 +++++++++++++++++++++++-----------------------
 1 file changed, 25 insertions(+), 25 deletions(-)
advsync/memorybarriers.tex +25 -25
index 3bf3a7f..7f1c3c8 100644
@@ -15,7 +15,7 @@ RCU.
 \begin{table}
 \centering{\tt
 \begin{tabular}{l|l}
-	Thread 1 & Thread 2 \\
+	\nf{Thread 1} & \nf{Thread 2} \\
 	\hline
 	x = 1;  & y = 1; \\
 	r1 = y; & r2 = x; \\
@@ -520,7 +520,7 @@ on this weaker if-then conditional ordering guarantee.
 \tt
 \scriptsize
 \begin{tabular}{l|l}
-	CPU 1 &			CPU 2 \\
+	\nf{CPU 1} &		\nf{CPU 2} \\
 	\hline
 	access(A);	&	access(B); \\
 	smp\_mb();	&	smp\_mb(); \\
@@ -615,7 +615,7 @@ pairings that portable software may depend on.
 	\tt
 	\scriptsize
 	\begin{tabular}{l|l}
-		CPU 1 &			CPU 2 \\
+		\nf{CPU 1} &		\nf{CPU 2} \\
 		\hline
 		A=1;		&	Y=B; \\
 		smp\_mb();	&	smp\_mb(); \\
@@ -647,7 +647,7 @@ pairings that portable software may depend on.
 	\tt
 	\scriptsize
 	\begin{tabular}{l|l}
-		CPU 1 &			CPU 2 \\
+		\nf{CPU 1} &		\nf{CPU 2} \\
 		\hline
 		X=A;            &	Y=B; \\
 		smp\_mb();	&	smp\_mb(); \\
@@ -684,7 +684,7 @@ pairings that portable software may depend on.
 	\tt
 	\scriptsize
 	\begin{tabular}{l|l}
-		CPU 1 &			CPU 2 \\
+		\nf{CPU 1} &		\nf{CPU 2} \\
 		\hline
 		X=A;		&	B=2; \\
 		smp\_mb();	&	smp\_mb(); \\
@@ -765,7 +765,7 @@ keep in mind that they used to be a \emph{lot} harder on some systems!
 	\tt
 	\scriptsize
 	\begin{tabular}{l|l}
-		CPU 1 &			CPU 2 \\
+		\nf{CPU 1} &		\nf{CPU 2} \\
 		\hline
 		A=1;		&	B=2; \\
 		smp\_mb();	&	smp\_mb(); \\
@@ -1050,7 +1050,7 @@ the sequence of operations might be as follows:
 \begin{minipage}[t]{\columnwidth}
 \tt \scriptsize
 \begin{tabular}{l|l}
-	CPU 1 &			CPU 2 \\
+	\nf{CPU 1} &		\nf{CPU 2} \\
 	\hline
 	(critical section) &	\tco{atomic_xchg(&lck->a, 1)->1} \\
 	\tco{smp_mb();}    &	lck->a->1 \\
@@ -1148,7 +1148,7 @@ initial values {\tt \{A = 1, B = 2\}}:
 \tt
 \scriptsize
 \begin{tabular}{l|l}
-	CPU 1 &		CPU 2 \\
+	\nf{CPU 1} &	\nf{CPU 2} \\
 	\hline
 	A = 3; &	x = A; \\
 	B = 4; &	y = B; \\
@@ -1205,7 +1205,7 @@ initial values {\tt \{A = 1, B = 2, C = 3, P = \&A, Q = \&C\}}:
 \tt
 \scriptsize
 \begin{tabular}{l|l}
-	CPU 1 &		CPU 2 \\
+	\nf{CPU 1} &	\nf{CPU 2} \\
 	\hline
 	B = 4; &	Q = P; \\
 	P = \&B &	D = *Q; \\
@@ -1654,7 +1654,7 @@ following sequence of events, with initial values
 \tt
 \scriptsize
 \begin{tabular}{l|l}
-	CPU 1 &		CPU 2 \\
+	\nf{CPU 1} &	\nf{CPU 2} \\
 	\hline
 	B = 4; & \\
 	<write barrier> & \\
@@ -1707,7 +1707,7 @@ address load and the data load (again with initial values of
 \tt
 \scriptsize
 \begin{tabular}{l|p{1.5in}}
-	CPU 1 &		CPU 2 \\
+	\nf{CPU 1} &	\nf{CPU 2} \\
 	\hline
 	B = 4; & \\
 	<write barrier> & \\
@@ -1743,7 +1743,7 @@ access with initial values
 \tt
 \scriptsize
 \begin{tabular}{l|p{1.5in}}
-	CPU 1 &		CPU 2 \\
+	\nf{CPU 1} &	\nf{CPU 2} \\
 	\hline
 	M[1] = 4; & \\
 	<write barrier> & \\
@@ -2074,7 +2074,7 @@ This is demonstrated by two related examples, with the initial values of
 \tt
 \scriptsize
 \begin{tabular}{l|p{1.5in}}
-	CPU 0 &		CPU 1 \\
+	\nf{CPU 0} &	\nf{CPU 1} \\
 	\hline
 	r1 = READ\_ONCE(x); &
 		r2 = READ\_ONCE(y); \\
@@ -2097,7 +2097,7 @@ not), then adding the following CPU would guarantee a related assertion:
 \tt
 \scriptsize
 \begin{tabular}{l}
-	CPU 2 \\
+	\nf{CPU 2} \\
 	\hline
 	WRITE\_ONCE(y, 1); \\
 	\multicolumn{1}{l}{~} \\
@@ -2181,7 +2181,7 @@ write barrier, though, again, a general barrier is viable:
 \tt
 \scriptsize
 \begin{tabular}{l|p{1.5in}}
-	CPU 1 &		CPU 2 \\
+	\nf{CPU 1} &	\nf{CPU 2} \\
 	\hline
 	A = 1; & \\
 	<write barrier> & \\
@@ -2200,7 +2200,7 @@ Or:
 \tt
 \scriptsize
 \begin{tabular}{l|p{1.5in}}
-	CPU 1 &		CPU 2 \\
+	\nf{CPU 1} &	\nf{CPU 2} \\
 	\hline
 	A = 1; & \\
 	<write barrier> & \\
@@ -2270,7 +2270,7 @@ loads.  Consider the following sequence of events with initial values
 \tt
 \scriptsize
 \begin{tabular}{l|p{1.5in}}
-	CPU 1 &		CPU 2 \\
+	\nf{CPU 1} &	\nf{CPU 2} \\
 	\hline
 	A = 1; & \\
 	B = 2; & \\
@@ -2306,7 +2306,7 @@ values of {\tt \{B = 7, X = 9, Y = 8, C = \&Y\}}:
 \tt
 \scriptsize
 \begin{tabular}{l|p{1.5in}}
-	CPU 1 &		CPU 2 \\
+	\nf{CPU 1} &	\nf{CPU 2} \\
 	\hline
 	A = 1; & \\
 	B = 2; & \\
@@ -2338,7 +2338,7 @@ following sequence of events, with initial values
 \tt
 \scriptsize
 \begin{tabular}{l|p{1.5in}}
-	CPU 1 &		CPU 2 \\
+	\nf{CPU 1} &	\nf{CPU 2} \\
 	\hline
 	A = 1; & \\
 	<write barrier> & \\
@@ -2369,7 +2369,7 @@ and the load of \co{A} on CPU~2, again with initial values of
 \tt
 \scriptsize
 \begin{tabular}{l|p{1.5in}}
-	CPU 1 &		CPU 2 \\
+	\nf{CPU 1} &	\nf{CPU 2} \\
 	\hline
 	A = 1; & \\
 	<write barrier> & \\
@@ -2402,7 +2402,7 @@ with the same initial values of
 \tt
 \scriptsize
 \begin{tabular}{l|p{1.5in}}
-	CPU 1 &		CPU 2 \\
+	\nf{CPU 1} &	\nf{CPU 2} \\
 	\hline
 	A = 1; & \\
 	<write barrier> & \\
@@ -2465,7 +2465,7 @@ For example, consider the following:
 \tt
 \scriptsize
 \begin{tabular}{l|p{1.5in}}
-	CPU 1 &		CPU 2 \\
+	\nf{CPU 1} &	\nf{CPU 2} \\
 	\hline
 		&	LOAD B \\
 		&	DIVIDE \\
@@ -2500,7 +2500,7 @@ load:
 \tt
 \scriptsize
 \begin{tabular}{l|p{1.5in}}
-	CPU 1 &		CPU 2 \\
+	\nf{CPU 1} &	\nf{CPU 2} \\
 	\hline
 		&	LOAD B \\
 		&	DIVIDE \\
@@ -2745,7 +2745,7 @@ a pair of locks named ``M'' and ``Q''.
 \begin{table}[htbp]
 \scriptsize\centering{\tt
 \begin{tabular}{r|l}
-  CPU 1 &	CPU 2 \\
+  \nf{CPU 1} &	\nf{CPU 2} \\
   \hline
   A = a; &	E = e; \\
   LOCK M; &	LOCK Q; \\
@@ -2785,7 +2785,7 @@ Table~\ref{tab:advsync:Ordering With Multiple CPUs on One Lock}?
 \begin{table}[htbp]
 \scriptsize\centering{\tt
 \begin{tabular}{r|l}
-  CPU 1 &	CPU 2 \\
+  \nf{CPU 1} &	\nf{CPU 2} \\
   \hline
   A = a; &	E = e; \\
   LOCK M; &	LOCK M; \\
Signature · 1 line
2.7.4
#12 lore raw

PATCH 12/13 whymemorybarriers: Add \nf{} command to table header

In reply to Akira Yokosawa

From bfed77e57f50ca1e4068f46c3b5b3ded1070287e Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sun, 1 Jan 2017 13:11:42 +0900
Subject: [PATCH 12/13] whymemorybarriers: Add \nf{} command to table header

---
 appendix/whymb/whymemorybarriers.tex | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
appendix/whymb/whymemorybarriers.tex +9 -9
index f97160a..bb8808d 100644
@@ -1357,9 +1357,9 @@ Each of ``a'', ``b'', and ``c'' are initially zero.
 \small
 \centering{\tt
 \begin{tabular}{l|l|l}
-	\multicolumn{1}{c|}{CPU~0} &
-		\multicolumn{1}{c|}{CPU~1} &
-			\multicolumn{1}{c}{CPU~2} \\
+	\multicolumn{1}{c|}{\nf{CPU~0}} &
+		\multicolumn{1}{c|}{\nf{CPU~1}} &
+			\multicolumn{1}{c}{\nf{CPU~2}} \\
 	\hline
 	\hline
 	a = 1;		 &		& \\
@@ -1417,9 +1417,9 @@ Both ``a'' and ``b'' are initially zero.
 \small
 \centering{\tt
 \begin{tabular}{l|l|l}
-	\multicolumn{1}{c|}{CPU~0} &
-		\multicolumn{1}{c|}{CPU~1} &
-			\multicolumn{1}{c}{CPU~2} \\
+	\multicolumn{1}{c|}{\nf{CPU~0}} &
+		\multicolumn{1}{c|}{\nf{CPU~1}} &
+			\multicolumn{1}{c}{\nf{CPU~2}} \\
 	\hline
 	\hline
 	a = 1;	     & while (a == 0); & \\
@@ -1459,9 +1459,9 @@ All variables are initially zero.
 \scriptsize
 \centering{\tt
 \begin{tabular}{r|l|l|l}
-	& \multicolumn{1}{c|}{CPU~0} &
-		\multicolumn{1}{c|}{CPU~1} &
-			\multicolumn{1}{c}{CPU~2} \\
+	& \multicolumn{1}{c|}{\nf{CPU~0}} &
+		\multicolumn{1}{c|}{\nf{CPU~1}} &
+			\multicolumn{1}{c}{\nf{CPU~2}} \\
 	\hline
 	\hline
  1 &	a = 1; &			& \\
Signature · 1 line
2.7.4
#13 lore raw

PATCH 13/13 memorybarriers: Add \nf{} command to descriptive words in table

In reply to Akira Yokosawa

From d07bf0df57c597c22de9a7c159f10b0247cea8c2 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Sun, 1 Jan 2017 14:02:06 +0900
Subject: [PATCH 13/13] memorybarriers: Add \nf{} command to descriptive words in table

---
 advsync/memorybarriers.tex | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
advsync/memorybarriers.tex +6 -6
index 7f1c3c8..74d4f7b 100644
@@ -2276,8 +2276,8 @@ loads.  Consider the following sequence of events with initial values
 	B = 2; & \\
 	<write barrier> & \\
 	C = \&B; & 	LOAD X\\
-	D = 4;	&	LOAD C (gets \&B) \\
-		&	LOAD *C (reads B) \\
+	D = 4;	&	LOAD C \nf{(gets \tco{&B})} \\
+		&	LOAD *C \nf{(reads \tco{B})} \\
 \end{tabular}
 \end{minipage}
 \vspace{5pt}
@@ -2312,9 +2312,9 @@ values of {\tt \{B = 7, X = 9, Y = 8, C = \&Y\}}:
 	B = 2; & \\
 	<write barrier> & \\
 	C = \&B; & 	LOAD X\\
-	D = 4;	&	LOAD C (gets \&B) \\
+	D = 4;	&	LOAD C \nf{(gets \tco{&B})} \\
 		&	<data dependency barrier> \\
-		&	LOAD *C (reads B) \\
+		&	LOAD *C \nf{(reads \tco{B})} \\
 \end{tabular}
 \end{minipage}
 \vspace{5pt}
@@ -2408,9 +2408,9 @@ with the same initial values of
 	<write barrier> & \\
 	B = 2; & \\
 		&	LOAD B \\
-		&	LOAD A (1\textsuperscript{st}) \\
+		&	LOAD A \nf{(1\textsuperscript{st})} \\
 		&	<read barrier> \\
-		&	LOAD A (2\textsuperscript{nd}) \\
+		&	LOAD A \nf{(2\textsuperscript{nd})} \\
 \end{tabular}
 \end{minipage}
 \vspace{5pt}
Signature · 1 line
2.7.4
#14 lore raw
In reply to Akira Yokosawa
Quoted 9 lines · Akira Yokosawa
Quoted 1 line

From d07bf0df57c597c22de9a7c159f10b0247cea8c2 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Wed, 4 Jan 2017 08:51:15 +0900
Subject: [PATCH 00/13] Remove \co{} commands in tables

\co{} command confuses column width estimation of tabular environment. By removing \co{} commands in tables, bogus "~"s for manual width adjustment can be removed.

Quoted 9 lines

Patch 1 introduces an alternative command \tco{} to be used in tables. Patches 2--8 remove \co{} commands by using \tco{} or removing unnecessary commands.
Patch 9 removes another "~" and uses \vspace{} instead.
Patches 10--13 do additional font tweaks. It looks better for me if headers of tables such as "Thread 1" and "CPU 1" are typeset in normal font of the text (Times Roman). Patch 13, which tweaks font of non-code words in table, may be an excessive tweak. Whether or not to apply it is up to the editor.

I queued and pushed these, thank you!

I am a little concerned about the added "\_" instances that show up in some of the tables, though. Does it work to use \tco{} or similar to avoid these? My concern is frustration for people searching the .tex source for tables containing (say) smp_wmb().

Thanx, Paul

Quoted 28 lines

--
Akira Yokosawa (13):
Define \tco{} command to be used in table
rcufundamental: Rewrite table 'RCU Publish and Subscribe Primitives'
rcuapi: Rewrite table 'RCU Wait-to-Finish APIs'
rcuapi: Rewrite table 'RCU Publish-Subscribe and Version Maintenance
APIs'
whichtochoose: Rewrite table 'Which Deferred Technique to Choose?'
memorybarriers: Remove \co{} in tabular env
memorybarriers: Use \verb in table 'Lock-Based Critical Sections'
whymemorybarriers: Remove \co{} in tabular env
memorybarriers: Replace nbsp with \vspace
Add \nf{} command to go back to normal font
memorybarriers: Add \nf{} command to table header
whymemorybarriers: Add \nf{} command to table header
memorybarriers: Add \nf{} command to descriptive words in table

 advsync/memorybarriers.tex           | 187 +++++++++++++++++------------------
 appendix/whymb/whymemorybarriers.tex |  70 ++++++-------
 defer/rcuapi.tex                     | 110 +++++++++------------
 defer/rcufundamental.tex             |  18 ++--
 defer/whichtochoose.tex              |  20 ++--
 perfbook.tex                         |   6 +-
 6 files changed, 200 insertions(+), 211 deletions(-)
Signature · 1 line
2.7.4
#15 lore raw

cover Use \tco{} for API names inside of tables

Quoted 20 lines · Paul E. McKenney
Quoted 9 lines · Akira Yokosawa
Quoted 1 line

From d07bf0df57c597c22de9a7c159f10b0247cea8c2 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Wed, 4 Jan 2017 08:51:15 +0900
Subject: [PATCH 00/13] Remove \co{} commands in tables

\co{} command confuses column width estimation of tabular environment. By removing \co{} commands in tables, bogus "~"s for manual width adjustment can be removed.

Quoted 9 lines

Patch 1 introduces an alternative command \tco{} to be used in tables. Patches 2--8 remove \co{} commands by using \tco{} or removing unnecessary commands.
Patch 9 removes another "~" and uses \vspace{} instead.
Patches 10--13 do additional font tweaks. It looks better for me if headers of tables such as "Thread 1" and "CPU 1" are typeset in normal font of the text (Times Roman). Patch 13, which tweaks font of non-code words in table, may be an excessive tweak. Whether or not to apply it is up to the editor.

Quoted 6 lines

I queued and pushed these, thank you!

I am a little concerned about the added "\_" instances that show up in some of the tables, though. Does it work to use \tco{} or similar to avoid these? My concern is frustration for people searching the .tex source for tables containing (say) smp_wmb().

I see your point. Using \tco{} for API names should work. A patch set follows.

In preparing this, I also found a long-lived typo in Table "Memory Barrier Example 3". Patch 2 fixes it.

Quoted 3 lines

Thanx, Paul

[snip]

--
Akira Yokosawa (2):
Use \tco{} for API names inside of tables
Fix typo smb_wmb() -> smp_wmb()

 advsync/memorybarriers.tex           | 20 ++++++++++----------
 appendix/whymb/whymemorybarriers.tex | 14 +++++++-------
 2 files changed, 17 insertions(+), 17 deletions(-)
Signature · 1 line
2.7.4
#16 lore raw

PATCH 1/2 Use \tco{} for API names inside of tables

From 93c2f3e7f773e15ff21ef2ea11a7d6c4e230b3c0 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 4 Jan 2017 18:38:02 +0900
Subject: [PATCH 1/2] Use \tco{} for API names inside of tables

For people searching API names in latex sources, escaping by "\" should be avoided.

---
 advsync/memorybarriers.tex           | 20 ++++++++++----------
 appendix/whymb/whymemorybarriers.tex | 14 +++++++-------
 2 files changed, 17 insertions(+), 17 deletions(-)
advsync/memorybarriers.tex +10 -10
index 74d4f7b..721d893 100644
@@ -523,7 +523,7 @@ on this weaker if-then conditional ordering guarantee.
 	\nf{CPU 1} &		\nf{CPU 2} \\
 	\hline
 	access(A);	&	access(B); \\
-	smp\_mb();	&	smp\_mb(); \\
+	\tco{smp_mb();}	&	\tco{smp_mb();} \\
 	access(B);	&	access(A); \\
 \end{tabular}
 \end{minipage}
@@ -618,7 +618,7 @@ pairings that portable software may depend on.
 		\nf{CPU 1} &		\nf{CPU 2} \\
 		\hline
 		A=1;		&	Y=B; \\
-		smp\_mb();	&	smp\_mb(); \\
+		\tco{smp_mb();}	&	\tco{smp_mb();} \\
 		B=1;		&	X=A; \\
 	\end{tabular}
 	\end{minipage}
@@ -650,7 +650,7 @@ pairings that portable software may depend on.
 		\nf{CPU 1} &		\nf{CPU 2} \\
 		\hline
 		X=A;            &	Y=B; \\
-		smp\_mb();	&	smp\_mb(); \\
+		\tco{smp_mb();}	&	\tco{smp_mb();} \\
 		B=1;            &	A=1; \\
 	\end{tabular}
 	\end{minipage}
@@ -687,7 +687,7 @@ pairings that portable software may depend on.
 		\nf{CPU 1} &		\nf{CPU 2} \\
 		\hline
 		X=A;		&	B=2; \\
-		smp\_mb();	&	smp\_mb(); \\
+		\tco{smp_mb();}	&	\tco{smp_mb();} \\
 		B=1;		&	A=1; \\
 	\end{tabular}
 	\end{minipage}
@@ -768,7 +768,7 @@ keep in mind that they used to be a \emph{lot} harder on some systems!
 		\nf{CPU 1} &		\nf{CPU 2} \\
 		\hline
 		A=1;		&	B=2; \\
-		smp\_mb();	&	smp\_mb(); \\
+		\tco{smp_mb();}	&	\tco{smp_mb();} \\
 		B=1;		&	A=2; \\
 	\end{tabular}
 	\end{minipage}
@@ -2076,12 +2076,12 @@ This is demonstrated by two related examples, with the initial values of
 \begin{tabular}{l|p{1.5in}}
 	\nf{CPU 0} &	\nf{CPU 1} \\
 	\hline
-	r1 = READ\_ONCE(x); &
-		r2 = READ\_ONCE(y); \\
+	\tco{r1 = READ_ONCE(x);} &
+		\tco{r2 = READ_ONCE(y);} \\
 	if (r1 > 0) &
 		if (r2 > 0) \\
-	~~~WRITE\_ONCE(y, 1); &
-		~~~WRITE\_ONCE(x, 1); \\
+	~~~\tco{WRITE_ONCE(y, 1);} &
+		~~~\tco{WRITE_ONCE(x, 1);} \\
 	\multicolumn{2}{l}{~} \\
 	\multicolumn{2}{l}{\tco{assert(!(r1 == 1 && r2 == 1));}} \\
 \end{tabular}
@@ -2099,7 +2099,7 @@ not), then adding the following CPU would guarantee a related assertion:
 \begin{tabular}{l}
 	\nf{CPU 2} \\
 	\hline
-	WRITE\_ONCE(y, 1); \\
+	\tco{WRITE_ONCE(y, 1);} \\
 	\multicolumn{1}{l}{~} \\
 	\multicolumn{1}{l}{\tco{assert(!(r1 == 1 && r2 == 1 && x == 1));}} \\
 \end{tabular}
appendix/whymb/whymemorybarriers.tex +7 -7
index bb8808d..0956226 100644
@@ -1363,9 +1363,9 @@ Each of ``a'', ``b'', and ``c'' are initially zero.
 	\hline
 	\hline
 	a = 1;		 &		& \\
-	smp\_wmb(); 	 & while (b == 0); & \\
+	\tco{smp_wmb();} & while (b == 0); & \\
 	b = 1;		 & c = 1;	& z = c; \\
-			 &		& smp\_rmb(); \\
+			 &		& \tco{smp_rmb();} \\
 			 &		& x = a; \\
 			 &		& assert(z == 0 || x == 1); \\
 \end{tabular}}
@@ -1423,8 +1423,8 @@ Both ``a'' and ``b'' are initially zero.
 	\hline
 	\hline
 	a = 1;	     & while (a == 0); & \\
-		     & smp\_mb();	& y = b; \\
-		     & b = 1;		& smp\_rmb(); \\
+		     & \tco{smp_mb();}	& y = b; \\
+		     & b = 1;		& \tco{smp_rmb();} \\
 		     &			& x = a; \\
 		     &			& assert(y == 0 || x == 1); \\
 \end{tabular}}
@@ -1465,13 +1465,13 @@ All variables are initially zero.
 	\hline
 	\hline
  1 &	a = 1; &			& \\
- 2 &	smb\_wmb();	&		& \\
+ 2 &	\tco{smb_wmb();}&		& \\
  3 &	b = 1;		& while (b == 0); & while (b == 0); \\
- 4 &			& smp\_mb();	& smp\_mb(); \\
+ 4 &			& \tco{smp_mb();}& \tco{smp_mb();} \\
  5 &			& c = 1;	& d = 1; \\
  6 &	while (c == 0); &		& \\
  7 &	while (d == 0); &		& \\
- 8 &	smp\_mb();	&		& \\
+ 8 &	\tco{smp_mb();}	&		& \\
  9 &	e = 1; &			& assert(e == 0 || a == 1); \\
 \end{tabular}}
 \caption{Memory Barrier Example 3}
Signature · 1 line
2.7.4
#17 lore raw

PATCH 2/2 Fix typo smb_wmb() -> smp_wmb()

In reply to Akira Yokosawa

From daa13e2a26b5470ed7b6082998aabdfd73cde517 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Wed, 4 Jan 2017 20:11:07 +0900
Subject: [PATCH 2/2] Fix typo smb_wmb() -> smp_wmb()

---
 appendix/whymb/whymemorybarriers.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
appendix/whymb/whymemorybarriers.tex +1 -1
index 0956226..70e1d30 100644
@@ -1465,7 +1465,7 @@ All variables are initially zero.
 	\hline
 	\hline
  1 &	a = 1; &			& \\
- 2 &	\tco{smb_wmb();}&		& \\
+ 2 &	\tco{smp_wmb();}&		& \\
  3 &	b = 1;		& while (b == 0); & while (b == 0); \\
  4 &			& \tco{smp_mb();}& \tco{smp_mb();} \\
  5 &			& c = 1;	& d = 1; \\
Signature · 1 line
2.7.4
#18 lore raw

Re: [PATCH 0/2] Use \tco{} for API names inside of tables

In reply to Akira Yokosawa
Quoted 28 lines · Akira Yokosawa
Quoted 20 lines · Paul E. McKenney
Quoted 9 lines · Akira Yokosawa
Quoted 1 line

From d07bf0df57c597c22de9a7c159f10b0247cea8c2 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Wed, 4 Jan 2017 08:51:15 +0900
Subject: [PATCH 00/13] Remove \co{} commands in tables

\co{} command confuses column width estimation of tabular environment. By removing \co{} commands in tables, bogus "~"s for manual width adjustment can be removed.

Quoted 9 lines

Patch 1 introduces an alternative command \tco{} to be used in tables. Patches 2--8 remove \co{} commands by using \tco{} or removing unnecessary commands.
Patch 9 removes another "~" and uses \vspace{} instead.
Patches 10--13 do additional font tweaks. It looks better for me if headers of tables such as "Thread 1" and "CPU 1" are typeset in normal font of the text (Times Roman). Patch 13, which tweaks font of non-code words in table, may be an excessive tweak. Whether or not to apply it is up to the editor.

Quoted 6 lines

I queued and pushed these, thank you!

I am a little concerned about the added "\_" instances that show up in some of the tables, though. Does it work to use \tco{} or similar to avoid these? My concern is frustration for people searching the .tex source for tables containing (say) smp_wmb().

Quoted 5 lines

I see your point. Using \tco{} for API names should work. A patch set follows.

In preparing this, I also found a long-lived typo in Table "Memory Barrier Example 3". Patch 2 fixes it.

Very good, queued and pushed!

Thanx, Paul

Quoted 14 lines

[snip]

--
Akira Yokosawa (2):
Use \tco{} for API names inside of tables
Fix typo smb_wmb() -> smp_wmb()

 advsync/memorybarriers.tex           | 20 ++++++++++----------
 appendix/whymb/whymemorybarriers.tex | 14 +++++++-------
 2 files changed, 17 insertions(+), 17 deletions(-)
Signature · 1 line
2.7.4