From: Joe Korty <joe.korty@ccur.com>
To: paulmck@linux.vnet.ibm.com
Cc: fweisbec@gmail.com, peterz@infradead.org, laijs@cn.fujitsu.com,
mathieu.desnoyers@efficios.com, dhowells@redhat.com,
loic.minier@linaro.org, dhaval.giani@gmail.com,
tglx@linutronix.de, josh@joshtriplett.org,
houston.jim@comcast.net, andi@firstfloor.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 9/9] jrcu: introduce alternate implementation of rcu_cpu
Date: Sun, 13 Mar 2011 23:50:44 -0400 [thread overview]
Message-ID: <20110314035044.GA12997@tsunami.ccur.com> (raw)
jrcu: introduce an alternate implementation of rcu_cpu().
This new implementation is based on smp_processor_id().
It is for those architectures which do not have
thread_info->cpu.
(We prefer the thread_info version as it works in early
boot where smp_processor_id() has not yet been set up).
Signed-off-by: Joe Korty <joe.korty@ccur.com>
Index: b/kernel/jrcu.c
===================================================================
--- a/kernel/jrcu.c
+++ b/kernel/jrcu.c
@@ -140,11 +140,27 @@ static u64 rcu_timestamp;
* know what that is. For RCU to work correctly, a cpu named '0' must
* eventually be present (but need not ever be online).
*/
+#ifdef HAVE_THREAD_INFO_CPU
static inline int rcu_cpu(void)
{
return current_thread_info()->cpu;
}
+#else
+
+static unsigned rcu_cpu_early_flag __read_mostly = 1;
+
+static inline int rcu_cpu(void)
+{
+ if (unlikely(rcu_cpu_early_flag)) {
+ if (!(rcu_scheduler_active && nr_cpu_ids > 1))
+ return 0;
+ rcu_cpu_early_flag = 0;
+ }
+ return raw_smp_processor_id();
+}
+#endif /* HAVE_THREAD_INFO_CPU */
+
/*
* Invoke whenever the calling CPU consents to end-of-batch. All CPUs
* must so consent before the batch is truly ended.
Index: b/arch/x86/include/asm/thread_info.h
===================================================================
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -29,6 +29,7 @@ struct thread_info {
__u32 flags; /* low level flags */
__u32 status; /* thread synchronous flags */
__u32 cpu; /* current CPU */
+#define HAVE_THREAD_INFO_CPU 1
int preempt_count; /* 0 => preemptable,
<0 => BUG */
mm_segment_t addr_limit;
reply other threads:[~2011-03-14 3:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20110314035044.GA12997@tsunami.ccur.com \
--to=joe.korty@ccur.com \
--cc=andi@firstfloor.org \
--cc=dhaval.giani@gmail.com \
--cc=dhowells@redhat.com \
--cc=fweisbec@gmail.com \
--cc=houston.jim@comcast.net \
--cc=josh@joshtriplett.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.minier@linaro.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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®