From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Akira Yokosawa <akiyks@gmail.com>
Cc: perfbook@vger.kernel.org
Subject: Re: [PATCH 2/3] toyrcu: Trivial typo fixes (rcu_idx -> rcu_refcnt)
Date: Wed, 21 Jun 2017 10:45:41 -0700 [thread overview]
Message-ID: <20170621174541.GJ3721@linux.vnet.ibm.com> (raw)
In-Reply-To: <6130a59b-a467-a83f-ecf5-40a52036c745@gmail.com>
On Wed, Jun 21, 2017 at 07:55:34AM +0900, Akira Yokosawa wrote:
> On 2017/06/20 23:28, Akira Yokosawa wrote:
> >>From db0fd6b383b551eabecb12dfa21e42093f338b2f Mon Sep 17 00:00:00 2001
> > From: Akira Yokosawa <akiyks@gmail.com>
> > Date: Mon, 19 Jun 2017 23:55:31 +0900
> > Subject: [PATCH 2/3] toyrcu: Trivial typo fixes (rcu_idx -> rcu_refcnt)
> >
> > Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
> > ---
> > appendix/toyrcu/toyrcu.tex | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/appendix/toyrcu/toyrcu.tex b/appendix/toyrcu/toyrcu.tex
> > index 79fbe33..a7bf6ca 100644
> > --- a/appendix/toyrcu/toyrcu.tex
> > +++ b/appendix/toyrcu/toyrcu.tex
> > @@ -524,10 +524,10 @@ by complementing the value of \co{rcu_idx}, as in \co{rcu_idx = !rcu_idx}.
> > Suppose that the old value of \co{rcu_idx} was zero, so that the new
> > value is one.
> > New readers that arrive after the complement operation will increment
> > -\co{rcu_idx[1]}, while the old readers that previously incremented
> > -\co{rcu_idx[0]} will decrement \co{rcu_idx[0]} when they exit their
> > +\co{rcu_refcnt[1]}, while the old readers that previously incremented
> > +\co{rcu_refcnt[0]} will decrement \co{rcu_refcnt[0]} when they exit their
> > RCU read-side critical sections.
> > -This means that the value of \co{rcu_idx[0]} will no longer be incremented,
> > +This means that the value of \co{rcu_refcnt[0]} will no longer be incremented,
> > and thus will be monotonically decreasing.\footnote{
> > There is a race condition that this ``monotonically decreasing''
> > statement ignores.
> > @@ -616,11 +616,11 @@ Lines~6 and 19 acquire and release \co{rcu_gp_lock} in order to
> > prevent more than one concurrent instance of \co{synchronize_rcu()}.
> > Lines~7-8 pick up the value of \co{rcu_idx} and complement it,
> > respectively, so that subsequent instances of \co{rcu_read_lock()}
> > -will use a different element of \co{rcu_idx} that did preceding
> > +will use a different element of \co{rcu_refcnt} that did preceding
> > instances.
>
> I have a little trouble with this sentence. Do you mean:
>
> ..., so that subsequent instances of \co{rcu_read_lock()}
> will use a different element of \co{rcu_refcnt} from the one did preceding
> instances.
Just to fully illustrate:
1. Suppose that rcu_idx is initially zero.
2. Any rcu_read_lock() invocations running at this point will
therefore be incrementing rcu_refcnt[0].
3. A synchronize_srcu() instance now complements rcu_idx, so that
its new value is one.
4. Any rcu_read_lock() invocations from step 2 that fetched rcu_idx
before step 3 completed will still increment rcu_refcnt[0].
5. However, any subsequent rcu_read_lock() invocations will instead
increment rcu_refcnt[1]. (At least until the next invocation
of synchronize_rcu().)
Does that help, or am I missing the point of your question?
Thanx, Paul
> ???
>
> Thanks, Akira
> > -Lines~10-12 then wait for the prior element of \co{rcu_idx} to
> > +Lines~10-12 then wait for the prior element of \co{rcu_refcnt} to
> > reach zero, with the memory barrier on line~9 ensuring that the check
> > -of \co{rcu_idx} is not reordered to precede the complementing of
> > +of \co{rcu_refcnt} is not reordered to precede the complementing of
> > \co{rcu_idx}.
> > Lines~13-18 repeat this process, and line~20 ensures that any
> > subsequent reclamation operations are not reordered to precede the
> >
>
next prev parent reply other threads:[~2017-06-21 17:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-20 14:26 [PATCH 0/3] toyrcu: Misc. fixes Akira Yokosawa
2017-06-20 14:27 ` [PATCH 1/3] toyrcu: Adjust reference to prerequisite chapters Akira Yokosawa
2017-06-20 14:28 ` [PATCH 2/3] toyrcu: Trivial typo fixes (rcu_idx -> rcu_refcnt) Akira Yokosawa
2017-06-20 22:55 ` Akira Yokosawa
2017-06-21 17:45 ` Paul E. McKenney [this message]
2017-06-21 22:46 ` Akira Yokosawa
2017-06-21 23:06 ` Paul E. McKenney
2017-06-20 14:29 ` [PATCH 3/3] future/QC: Another math mode fix Akira Yokosawa
2017-06-20 17:27 ` [PATCH 0/3] toyrcu: Misc. fixes 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=20170621174541.GJ3721@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=akiyks@gmail.com \
--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.