* [PATCH 0/2] Update code snippets
@ 2017-05-22 15:10 Akira Yokosawa
2017-05-22 15:11 ` [PATCH 1/2] toolsoftrade: Update definition of READ_ONCE() Akira Yokosawa
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Akira Yokosawa @ 2017-05-22 15:10 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
From edbd0adf8aafef3704b9059ae484ee44f2aa308e Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Tue, 23 May 2017 00:01:27 +0900
Subject: [PATCH 0/2] Update code snippets
Hi Paul,
These are follow-up patches regarding recent updates in
CodeSamples/count/count_stat_eventual.c.
Thanks, Akira
--
Akira Yokosawa (2):
toolsoftrade: Update definition of READ_ONCE()
count: Remove unnecessay smp_mb() in code snippet
count/count.tex | 11 +++++------
toolsoftrade/toolsoftrade.tex | 3 ++-
2 files changed, 7 insertions(+), 7 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] toolsoftrade: Update definition of READ_ONCE()
2017-05-22 15:10 [PATCH 0/2] Update code snippets Akira Yokosawa
@ 2017-05-22 15:11 ` Akira Yokosawa
2017-05-22 15:13 ` [PATCH 2/2] count: Remove unnecessary smp_mb() in code snippet Akira Yokosawa
2017-05-23 0:39 ` [PATCH 0/2] Update code snippets Paul E. McKenney
2 siblings, 0 replies; 4+ messages in thread
From: Akira Yokosawa @ 2017-05-22 15:11 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
From e61f1ef20186fe24d7cec92b43f41a5efda524cb Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Mon, 22 May 2017 23:42:06 +0900
Subject: [PATCH 1/2] toolsoftrade: Update definition of READ_ONCE()
Reflect the change in commit 85747990ec80 ("count: Don't in-place
increment a READ_ONCE()").
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
toolsoftrade/toolsoftrade.tex | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/toolsoftrade/toolsoftrade.tex b/toolsoftrade/toolsoftrade.tex
index cecb2d3..9ccd4bc 100644
--- a/toolsoftrade/toolsoftrade.tex
+++ b/toolsoftrade/toolsoftrade.tex
@@ -1258,7 +1258,8 @@ but may be implemented straightforwardly as follows:
\scriptsize
\begin{verbatim}
#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
-#define READ_ONCE(x) ACCESS_ONCE(x)
+#define READ_ONCE(x) \
+ ({ typeof(x) ___x = ACCESS_ONCE(x); ___x; })
#define WRITE_ONCE(x, val) ({ ACCESS_ONCE(x) = (val); })
#define barrier() __asm__ __volatile__("": : :"memory")
\end{verbatim}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] count: Remove unnecessary smp_mb() in code snippet
2017-05-22 15:10 [PATCH 0/2] Update code snippets Akira Yokosawa
2017-05-22 15:11 ` [PATCH 1/2] toolsoftrade: Update definition of READ_ONCE() Akira Yokosawa
@ 2017-05-22 15:13 ` Akira Yokosawa
2017-05-23 0:39 ` [PATCH 0/2] Update code snippets Paul E. McKenney
2 siblings, 0 replies; 4+ messages in thread
From: Akira Yokosawa @ 2017-05-22 15:13 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
From edbd0adf8aafef3704b9059ae484ee44f2aa308e Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Mon, 22 May 2017 23:46:27 +0900
Subject: [PATCH 2/2] count: Remove unnecessary smp_mb() in code snippet
Reflect the fix made in commit 853027876a8c ("count_stat_eventual:
Remove unnecessary smp_mb()").
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
count/count.tex | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/count/count.tex b/count/count.tex
index ae624c6..1b5b030 100644
--- a/count/count.tex
+++ b/count/count.tex
@@ -793,11 +793,10 @@ eventually consistent.
45 void count_cleanup(void)
46 {
47 WRITE_ONCE(stopflag, 1);
-48 smp_mb();
-49 while (READ_ONCE(stopflag) < 3)
-50 poll(NULL, 0, 1);
-51 smp_mb();
-52 }
+48 while (READ_ONCE(stopflag) < 3)
+49 poll(NULL, 0, 1);
+50 smp_mb();
+51 }
\end{verbbox}
}
\centering
@@ -826,7 +825,7 @@ summing the per-thread local \co{counter} and storing the
sum to the \co{global_count} variable.
The \co{eventual()} thread waits an arbitrarily chosen one millisecond
between passes.
-The \co{count_cleanup()} function on lines~45-52 coordinates termination.
+The \co{count_cleanup()} function on lines~45-51 coordinates termination.
This approach gives extremely fast counter read-out while still
supporting linear counter-update performance.
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] Update code snippets
2017-05-22 15:10 [PATCH 0/2] Update code snippets Akira Yokosawa
2017-05-22 15:11 ` [PATCH 1/2] toolsoftrade: Update definition of READ_ONCE() Akira Yokosawa
2017-05-22 15:13 ` [PATCH 2/2] count: Remove unnecessary smp_mb() in code snippet Akira Yokosawa
@ 2017-05-23 0:39 ` Paul E. McKenney
2 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2017-05-23 0:39 UTC (permalink / raw)
To: Akira Yokosawa; +Cc: perfbook
On Tue, May 23, 2017 at 12:10:07AM +0900, Akira Yokosawa wrote:
> >From edbd0adf8aafef3704b9059ae484ee44f2aa308e Mon Sep 17 00:00:00 2001
> From: Akira Yokosawa <akiyks@gmail.com>
> Date: Tue, 23 May 2017 00:01:27 +0900
> Subject: [PATCH 0/2] Update code snippets
>
> Hi Paul,
>
> These are follow-up patches regarding recent updates in
> CodeSamples/count/count_stat_eventual.c.
Applied and pushed, thank you!
Thanx, Paul
> Thanks, Akira
> --
> Akira Yokosawa (2):
> toolsoftrade: Update definition of READ_ONCE()
> count: Remove unnecessay smp_mb() in code snippet
>
> count/count.tex | 11 +++++------
> toolsoftrade/toolsoftrade.tex | 3 ++-
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-23 0:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-22 15:10 [PATCH 0/2] Update code snippets Akira Yokosawa
2017-05-22 15:11 ` [PATCH 1/2] toolsoftrade: Update definition of READ_ONCE() Akira Yokosawa
2017-05-22 15:13 ` [PATCH 2/2] count: Remove unnecessary smp_mb() in code snippet Akira Yokosawa
2017-05-23 0:39 ` [PATCH 0/2] Update code snippets Paul E. McKenney
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.