From: Akira Yokosawa <akiyks@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: perfbook@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>
Subject: [PATCH -perfbook 2/3] defer, together: Group consecutive QQzs
Date: Thu, 10 Feb 2022 00:08:30 +0900 [thread overview]
Message-ID: <bae71121-9ade-7836-ef5d-a13608921c76@gmail.com> (raw)
In-Reply-To: <b9607a1e-7ab2-62fb-578e-d9dec3547905@gmail.com>
These consecutive pairs of plain QQzs should be grouped by the
\QuickQuizSeries{ ... } construct.
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
defer/rcuusage.tex | 14 ++++++++------
together/seqlock.tex | 14 ++++++++------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/defer/rcuusage.tex b/defer/rcuusage.tex
index 2fb517c2..7a624e4c 100644
--- a/defer/rcuusage.tex
+++ b/defer/rcuusage.tex
@@ -506,13 +506,14 @@ run concurrently with \co{do_maint()} to complete, and finally
\clnref{toquick} sets the \co{be_careful} flag back to \co{false}.
\end{fcvref}
-\QuickQuiz{
+\QuickQuizSeries{%
+\QuickQuizB{
What is the point of the second call to \co{synchronize_rcu()}
in function
\co{maint()} in \cref{lst:defer:Phased State Change for Maintenance Operations}?
Isn't it OK for any \co{cco()} invocations in the clean-up
phase to invoke either \co{cco_carefully()} or \co{cco_quickly()}?
-}\QuickQuizAnswer{
+}\QuickQuizAnswerB{
The problem is that there is no ordering between the \co{cco()}
function's load from \co{be_careful} and any memory loads
executed by the \co{cco_quickly()} function.
@@ -525,13 +526,13 @@ run concurrently with \co{do_maint()} to complete, and finally
\co{READ_ONCE()} to \co{smp_load_acquire()} and the
\co{WRITE_ONCE()} to \co{smp_store_release()}, thus restoring
the needed ordering.
-}\QuickQuizEnd
+}\QuickQuizEndB
-\QuickQuiz{
+\QuickQuizE{
How can you be sure that the code shown in
\co{maint()} in \cref{lst:defer:Phased State Change for Maintenance Operations}
really works?\@
-}\QuickQuizAnswer{
+}\QuickQuizAnswerE{
By one popular school of thought, you cannot.
But in this case, those willing to jump ahead to
@@ -543,7 +544,8 @@ run concurrently with \co{do_maint()} to complete, and finally
\path{C-RCU-phased-state-change-2.litmus}).
These tests could be argued to demonstrate that this code
and a variant of it really do work.
-}\QuickQuizEnd
+}\QuickQuizEndE
+}% End of \QuickQuizSeries
Phased state change allows frequent operations to use light-weight
checks, without the need for expensive lock acquisitions or atomic
diff --git a/together/seqlock.tex b/together/seqlock.tex
index b8acbe3d..42eb8faa 100644
--- a/together/seqlock.tex
+++ b/together/seqlock.tex
@@ -221,11 +221,12 @@ Any reader succeeding in looking up the new name is guaranteed that
any subsequent lookup of the old name will fail, perhaps after a series
of retries.
-\QuickQuiz{
+\QuickQuizSeries{%
+\QuickQuizB{
Is it possible to write-acquire the sequence lock on
the new element before it is inserted instead of acquiring
that of the old element before it is removed?
-}\QuickQuizAnswer{
+}\QuickQuizAnswerB{
Yes, and the details are left as an exercise to the reader.
The term \emph{tombstone} is sometimes used to refer to the
@@ -233,11 +234,11 @@ of retries.
Similarly, the term \emph{birthstone} is sometimes used to refer
to the element with the new name while its sequence lock is
still held.
-}\QuickQuizEnd
+}\QuickQuizEndB
-\QuickQuiz{
+\QuickQuizE{
Is it possible to avoid the global lock?
-}\QuickQuizAnswer{
+}\QuickQuizAnswerE{
Yes, and one way to do this would be to use per-hash-chain locks.
The updater could acquire lock(s) corresponding to both the old
and the new element, acquiring them in address order.
@@ -247,7 +248,8 @@ of retries.
This complexity can be worthwhile if rename operations are
frequent, and of course can allow rename operations to execute
concurrently.
-}\QuickQuizEnd
+}\QuickQuizEndE
+}% End of \QuickQuizSeries
It is of course possible to instead implement this procedure somewhat
more efficiently using simple flags.
--
2.17.1
next prev parent reply other threads:[~2022-02-09 15:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 15:06 [PATCH -perfbook 1/3] intro, together: Promote section-opening QQzs to 'essential' Akira Yokosawa
2022-02-09 15:08 ` Akira Yokosawa [this message]
2022-02-09 15:12 ` [PATCH -perfbook 3/3] cleverefcheck.pl: Add patterns to catch QQz positioning issues Akira Yokosawa
2022-02-09 15:17 ` Akira Yokosawa
2022-02-09 21:31 ` [PATCH -perfbook 1/3] intro, together: Promote section-opening QQzs to 'essential' Paul E. McKenney
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=bae71121-9ade-7836-ef5d-a13608921c76@gmail.com \
--to=akiyks@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 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.