From: Shan Wei <shanwei88@gmail.com>
To: Christoph Lameter <cl@linux.com>
Cc: steffen.klassert@secunet.com, David Miller <davem@davemloft.net>,
NetDev <netdev@vger.kernel.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
Kernel-Maillist <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/9] net: xfrm: use this_cpu_ptr per-cpu helper
Date: Thu, 01 Nov 2012 16:56:54 +0800 [thread overview]
Message-ID: <50923956.5090206@gmail.com> (raw)
In-Reply-To: <0000013ab7e4a640-60bd5b38-a1fc-4730-b918-4109211ffea0-000000@email.amazonses.com>
Christoph Lameter said, at 2012/11/1 1:35:
> It would be better to use
>
> this_cpu_read(tfms)
>
> since that would also make it atomic vs interrupts. The above code (both
> original and modified) could determine a pointer to a per cpu structure
> and then take an interrupt which would move the task. On return we would
> be accessing the per cpu variable of another processor.
this_cpu_read
|-----_this_cpu_generic_read
#define _this_cpu_generic_read(pcp) \
({ typeof(pcp) ret__; \
preempt_disable(); \
ret__ = *this_cpu_ptr(&(pcp)); \
preempt_enable(); \
ret__; \
})
this_cpu_read operations locate per-cpu variable with preemption safe, not
disable interrupts. why is it atomic vs interrupts?
I have no idea whether we need to disable preemption for this code?
At least, xfrm code run well with per_cpu_ptr which don't disable preemption.
next prev parent reply other threads:[~2012-11-01 8:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-31 11:22 [PATCH 3/9] net: xfrm: use this_cpu_ptr per-cpu helper Shan Wei
2012-10-31 17:35 ` Christoph Lameter
2012-11-01 3:41 ` Herbert Xu
2012-11-01 9:00 ` Shan Wei
2012-11-01 8:56 ` Shan Wei [this message]
2012-11-01 9:18 ` Steffen Klassert
2012-11-01 12:15 ` David Laight
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=50923956.5090206@gmail.com \
--to=shanwei88@gmail.com \
--cc=cl@linux.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.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;
as well as URLs for NNTP newsgroup(s).