From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Thomas Gleixner <tglx@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [GIT PULL] RCU changes for v3.4
Date: Fri, 23 Mar 2012 21:48:30 -0700 [thread overview]
Message-ID: <20120324044830.GF2450@linux.vnet.ibm.com> (raw)
In-Reply-To: <CA+55aFxRJ+=j91vhZdDu0har8qvhLeP4fea_cSXzkaRE84wvvg@mail.gmail.com>
On Fri, Mar 23, 2012 at 09:25:04PM -0700, Linus Torvalds wrote:
> On Fri, Mar 23, 2012 at 9:17 PM, Paul E. McKenney
> <paulmck@linux.vnet.ibm.com> wrote:
> >
> > I must admit that __this_cpu_inc() would be nicer than __this_cpu_add(),
> > though, will fix. I need the leading "__" to avoid disabling preemption
> > needlessly on non-x86 platforms.
>
> Yeah, that's just bogus. Ok on that.
>
> > The reason that the "__raw" forms are
> > safe in this case is because the per-CPU variable is saved and restored
> > at context-switch time.
> >
> > Or am I still missing something here?
>
> It's not that the "__raw" forms are "safe". It's that they are SH*T.
>
> Don't use them. They are crap. Why would you do
>
> + __raw_get_cpu_var(rcu_read_lock_nesting) =
> + current->rcu_read_lock_nesting_save;
>
> which is just crazy and cannot use the actual sane "%fs:" segment
> overrides, but instead has to do idiotic "ready the per-cpu offset
> pointer and add it in".
>
> We've got "__this_cpu_write()" which generates the correct code.
>
> Rule of thumb: there is _never_ any good reason to use
> __raw_get_cpu_var. It's a broken interface.
OK, I will switch to __this_cpu_write(), thank you for the tip.
Thanx, Paul
prev parent reply other threads:[~2012-03-24 4:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-19 15:23 [GIT PULL] RCU changes for v3.4 Ingo Molnar
2012-03-20 0:18 ` Linus Torvalds
2012-03-20 3:33 ` Paul E. McKenney
2012-03-20 6:13 ` Ingo Molnar
2012-03-23 1:08 ` Linus Torvalds
2012-03-23 19:21 ` Paul E. McKenney
2012-03-23 19:39 ` Linus Torvalds
2012-03-23 21:16 ` Paul E. McKenney
2012-03-23 21:25 ` Paul E. McKenney
2012-03-24 1:47 ` Paul E. McKenney
2012-03-24 2:00 ` Linus Torvalds
2012-03-24 4:17 ` Paul E. McKenney
2012-03-24 4:25 ` Linus Torvalds
2012-03-24 4:48 ` Paul E. McKenney [this message]
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=20120324044830.GF2450@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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