[PATCH 2/2] Let a writer thread go back to the original CPU in the toy RCU pseudocode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This commit a little bit improves the logic of a writer thread. The
new logic lets the writer go back to the original CPU after run_on()
the final CPU.

Of course it is a trivial improvement and the original two lines
pseudocode is beautiful. If it isn't worth to apply, please ignore it.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@xxxxxxxxx>
---
 defer/rcuintro.tex | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/defer/rcuintro.tex b/defer/rcuintro.tex
index 03d6e12..135922c 100644
--- a/defer/rcuintro.tex
+++ b/defer/rcuintro.tex
@@ -166,8 +166,11 @@ quite complex, a toy implementation is exceedingly simple:
 \begin{minipage}[t]{\columnwidth}
 \scriptsize
 \begin{verbatim}
-  1 for_each_online_cpu(cpu)
-  2   run_on(cpu);
+  1 int orig_cpu = smp_processor_id();
+  2 for_each_online_cpu(cpu)
+  3   run_on(cpu);
+  4 if (orig_cpu != smp_processor_id())
+  5   run_on(orig_cpu);
 \end{verbatim}
 \end{minipage}
 \vspace{5pt}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe perfbook" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux