From: Oleg Nesterov <oleg@tv-sign.ru>
To: vatsa@in.ibm.com
Cc: linux-kernel@vger.kernel.org,
Dipankar Sarma <dipankar@in.ibm.com>,
"Paul E. McKenney" <paulmck@us.ibm.com>,
Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] Fix RCU race in access of nohz_cpu_mask
Date: Fri, 09 Dec 2005 22:17:38 +0300 [thread overview]
Message-ID: <4399D852.47E0BB4E@tv-sign.ru> (raw)
In-Reply-To: <20051209024623.GA14844@in.ibm.com>
Srivatsa Vaddagiri wrote:
>
> On Thu, Dec 08, 2005 at 10:31:06PM +0300, Oleg Nesterov wrote:
> > I can't see how this change can prevent idle cpus to be included in
> > ->cpumask, cpu can add itself to nohz_cpu_mask right after some other
> > cpu started new grace period.
>
> Yes that can happen, but if they check for rcu_pending right after that
> it will prevent them from going tickless atleast (which will prevent grace
> periods from being unnecessarily extended). Something like below:
>
> CPU0 CPU1
>
> rcp->cur++; /* New GP */
>
> smp_mb();
I think I need some education on memory barriers.
Does this mb() garantees that the new value of ->cur will be visible
on other cpus immediately after smp_mb() (so that rcu_pending() will
notice it) ?
My understanding is that it only garantees that all stores before it
must be visible before any store after mb. (yes, mb implies rmb, but
I think it does not matter if CPU1 adds itself to nonhz mask after
CPU0 reads nohz_cpu_mask). This means that CPU1 can read the stale
value of ->cur. I guess I am wrong, but I can't prove it to myself.
Could you please clarify this?
Even simpler question:
CPU0
var = 1;
wmb();
after that CPU1 does rmb().
Does it garantees that CPU1 will see the new value of var?
> Ideally we would have needed a smp_mb() in CPU1 also between setting CPU1
> in nohz_cpu_mask and checking for rcu_pending(), but I guess it is not needed
> in s390 because of its strong ordering?
I don't know, but please note that s390's definition of smp_mb__after_atomic_inc()
is not a 'nop'.
Oleg.
next prev parent reply other threads:[~2005-12-09 18:02 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-08 19:31 Oleg Nesterov
2005-12-09 2:46 ` Srivatsa Vaddagiri
2005-12-09 19:17 ` Oleg Nesterov [this message]
2005-12-10 15:19 ` Srivatsa Vaddagiri
2005-12-10 18:55 ` Oleg Nesterov
2005-12-11 17:41 ` Semantics of smp_mb() [was : Re: [PATCH] Fix RCU race in access of nohz_cpu_mask ] Srivatsa Vaddagiri
2005-12-11 21:21 ` Andrew James Wade
2005-12-11 23:45 ` Rusty Russell
2005-12-12 0:49 ` Keith Owens
2005-12-12 8:41 ` Srivatsa Vaddagiri
2005-12-12 19:33 ` Oleg Nesterov
2005-12-13 5:20 ` Paul E. McKenney
2005-12-13 5:07 ` Andrew James Wade
2005-12-13 5:43 ` Paul E. McKenney
2005-12-13 11:20 ` Andi Kleen
2005-12-13 16:20 ` Paul E. McKenney
2005-12-13 22:27 ` Keith Owens
2005-12-13 22:50 ` Paul E. McKenney
2005-12-14 1:12 ` Andi Kleen
2005-12-14 1:46 ` Paul E. McKenney
2005-12-15 21:15 ` Semantics of smp_mb() Roland Dreier
2005-12-16 7:46 ` Semantics of smp_mb() [was : Re: [PATCH] Fix RCU race in access of nohz_cpu_mask ] Jeremy Higdon
2006-03-13 18:39 ` Paul E. McKenney
2006-03-31 4:56 ` Jeremy Higdon
2006-03-31 6:18 ` Paul E. McKenney
2006-03-31 23:38 ` Jesse Barnes
2005-12-12 3:10 ` [PATCH] Fix RCU race in access of nohz_cpu_mask Paul E. McKenney
2005-12-12 4:32 ` Andrew Morton
2005-12-12 4:38 ` David S. Miller
2005-12-12 4:47 ` Nick Piggin
2005-12-12 4:49 ` Paul Mackerras
2005-12-12 6:27 ` Keith Owens
2005-12-09 2:56 ` Srivatsa Vaddagiri
-- strict thread matches above, loose matches on Subject: below --
2005-12-05 11:02 Srivatsa Vaddagiri
2005-12-08 0:37 ` Andrew Morton
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=4399D852.47E0BB4E@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@osdl.org \
--cc=dipankar@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@us.ibm.com \
--cc=vatsa@in.ibm.com \
/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
all inboxes | Powered by JetHome®