From: Alan Huang <mmpgouride@gmail.com>
To: paulmck@kernel.org
Cc: perfbook@vger.kernel.org, Alan Huang <mmpgouride@gmail.com>
Subject: [PATCH 1/2] CodeSample/count: Use plain access instead of WRITE_ONCE
Date: Sun, 28 May 2023 14:37:28 +0000 [thread overview]
Message-ID: <20230528143729.15201-1-mmpgouride@gmail.com> (raw)
The cap here has not been published, plain access is enough.
Signed-off-by: Alan Huang <mmpgouride@gmail.com>
---
CodeSamples/count/count_end_rcu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CodeSamples/count/count_end_rcu.c b/CodeSamples/count/count_end_rcu.c
index 1171f0b6..8fc70611 100644
--- a/CodeSamples/count/count_end_rcu.c
+++ b/CodeSamples/count/count_end_rcu.c
@@ -89,7 +89,7 @@ void count_unregister_thread(int nthreadsexpected) //\lnlbl{unreg:b}
} //\lnlbl{unreg:alloc:e}
spin_lock(&final_mutex); //\lnlbl{unreg:acq}
*cap = *countarrayp; //\lnlbl{unreg:copy}
- WRITE_ONCE(cap->total, cap->total + counter); //\lnlbl{unreg:add}
+ cap->total += counter; //\lnlbl{unreg:add}
cap->counterp[idx] = NULL; //\lnlbl{unreg:null}
capold = countarrayp; //\lnlbl{unreg:retain}
rcu_assign_pointer(countarrayp, cap); //\lnlbl{unreg:assign}
--
2.34.1
next reply other threads:[~2023-05-28 14:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-28 14:37 Alan Huang [this message]
2023-05-28 14:37 ` [PATCH 2/2] together: Remove wrong content Alan Huang
2023-05-30 0:30 ` [PATCH 1/2] CodeSample/count: Use plain access instead of WRITE_ONCE Paul E. McKenney
2023-05-30 14:53 ` Alan Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230528143729.15201-1-mmpgouride@gmail.com \
--to=mmpgouride@gmail.com \
--cc=paulmck@kernel.org \
--cc=perfbook@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).