Skip to content

Use READ_ONCE() and WRITE_ONCE in count_stat_eventual.c

Junchang Wang perfbook 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 19 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2count_stat_eventual: Switch from ACCESS_ONCE() to READ_ONCE()/WRITE_ONCE()CodeSamples/count/count_stat_eventual.c+4 -414 replies
2/2count_stat_eventual: Add READ_ONCE() to protect global shared variable stopflagCodeSamples/count/count_stat_eventual.c+6 -54 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Use READ_ONCE() and WRITE_ONCE in count_stat_eventual.c

Hi Paul,

Please check the updated patch. The first patch is to replace existing ACCESS_ONCE to new READ/WRITE_ONCE primitives, and the second to protect global share variable stopflag.

BTW, I didn't see any performance differences between versions using volatile and READ/WRITE_ONCE primitives on my 16 cores Intel machine. I guess the major reason is that the sample code is simple such that registers are enough even if keyword volatile is used.

Junchang Wang (2):
count_stat_eventual: Switch from ACCESS_ONCE() to

    READ_ONCE()/WRITE_ONCE()

count_stat_eventual: Add READ_ONCE() to protect global shared variable
stopflag

 CodeSamples/count/count_stat_eventual.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
Signature · 1 line
2.7.4