>From f37685cb3821daf0d9ee55a538ec462e5de0a6a8 Mon Sep 17 00:00:00 2001 From: Akira Yokosawa <akiyks@xxxxxxxxx> Date: Tue, 4 Jun 2019 00:35:02 +0900 Subject: [PATCH 6/7] toyrcu: Extract Listing B.13 from rcu.h Commit 686f3f3b721c ("rcu: Use READ_ONCE() and WRITE_ONCE() for shared variable rcu_gp_ctr") updated B.14 to reflect the changes in rcu.[hc]. For consistency, extract Listing B.13 from rcu.h. Cc: Junchang Wang <junchangwang@xxxxxxxxx> Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx> --- CodeSamples/defer/rcu.h | 2 ++ appendix/toyrcu/toyrcu.tex | 11 +---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/CodeSamples/defer/rcu.h b/CodeSamples/defer/rcu.h index 3641c33a..b3c3e2c4 100644 --- a/CodeSamples/defer/rcu.h +++ b/CodeSamples/defer/rcu.h @@ -20,10 +20,12 @@ #include "rcu_pointer.h" +//\begin{snippet}[labelbase=ln:defer:rcu:define,commandchars=\%\@\$] DEFINE_SPINLOCK(rcu_gp_lock); long rcu_gp_ctr = 0; /* always even, +=2 at start of each grace period. */ DEFINE_PER_THREAD(long, rcu_reader_gp); DEFINE_PER_THREAD(long, rcu_reader_gp_snap); +//\end{snippet} static inline void rcu_init(void) { diff --git a/appendix/toyrcu/toyrcu.tex b/appendix/toyrcu/toyrcu.tex index 81f222c6..f6ce2bee 100644 --- a/appendix/toyrcu/toyrcu.tex +++ b/appendix/toyrcu/toyrcu.tex @@ -1185,16 +1185,7 @@ thread-local accesses to one, as is done in the next section. \label{sec:app:toyrcu:RCU Based on Free-Running Counter} \begin{listing}[tbp] -{ \scriptsize -\begin{verbbox} - 1 DEFINE_SPINLOCK(rcu_gp_lock); - 2 long rcu_gp_ctr = 0; - 3 DEFINE_PER_THREAD(long, rcu_reader_gp); - 4 DEFINE_PER_THREAD(long, rcu_reader_gp_snap); -\end{verbbox} -} -\centering -\theverbbox +\input{CodeSamples/defer/rcu@xxxxxxxxxx} \caption{Data for Free-Running Counter Using RCU} \label{lst:app:toyrcu:Data for Free-Running Counter Using RCU} \end{listing} -- 2.17.1