Message from discussion
rcu: Inline preemptible RCU __rcu_read_lock()
Received: by 10.68.236.198 with SMTP id uw6mr5318150pbc.3.1334420468795;
Sat, 14 Apr 2012 09:21:08 -0700 (PDT)
MIME-Version: 1.0
Path: r9ni55843pbh.0!nntp.google.com!news2.google.com!goblin3!goblin1!goblin.stu.neva.ru!uio.no!nntp.uio.no!.POSTED!not-for-mail
From: "Paul E. McKenney" <paul...@linux.vnet.ibm.com>
Newsgroups: fa.linux.kernel
Subject: [PATCH RFC 6/7] rcu: Inline preemptible RCU __rcu_read_lock()
Date: Sat, 14 Apr 2012 16:21:08 UTC
Organization: Internet mailing list
Lines: 75
Sender: linux-kernel-ow...@vger.kernel.org
Message-ID: <fa.rju7kiJbmFtgoancKWobrqHX88o@ifi.uio.no>
References: <fa.IMPAJQVuHQekEJey2Lkez0xW+Y0@ifi.uio.no> <fa.gx+0jnZ0zO7EENc027qKLqku2Yc@ifi.uio.no>
NNTP-Posting-Host: mail-jess.uio.no
X-Trace: readme.uio.no 1334420468 2335 129.240.7.9 (14 Apr 2012 16:21:08 GMT)
X-Complaints-To: abuse@uio.no
NNTP-Posting-Date: Sat, 14 Apr 2012 16:21:08 +0000 (UTC)
Cc: mi...@elte.hu, la...@cn.fujitsu.com, dipan...@in.ibm.com,
a...@linux-foundation.org, mathieu.desnoy...@polymtl.ca,
j...@joshtriplett.org, n...@us.ibm.com, t...@linutronix.de,
pet...@infradead.org, rost...@goodmis.org, Valdis.Kletni...@vt.edu,
dhowe...@redhat.com, eric.duma...@gmail.com, dar...@dvhart.com,
fweis...@gmail.com, patc...@linaro.org,
torva...@linux-foundation.org,
"Paul E. McKenney" <paul.mcken...@linaro.org>,
"Paul E. McKenney" <paul...@linux.vnet.ibm.com>
To: linux-ker...@vger.kernel.org
X-Mailer: git-send-email 1.7.8
In-Reply-To: <1334420437-19264-1-git-send-email-paulmck@linux.vnet.ibm.com>
X-Content-Scanned: Fidelis XPS MAILER
x-cbid: 12041416-2398-0000-0000-000005D1BC38
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org
Original-Date: Sat, 14 Apr 2012 09:20:36 -0700
Original-Message-Id: <1334420437-19264-6-git-send-email-paulmck@linux.vnet.ibm.com>
Original-References: <20120414161953.GA18...@linux.vnet.ibm.com>
<1334420437-19264-1-git-send-email-paul...@linux.vnet.ibm.com>
From: "Paul E. McKenney" <paul.mcken...@linaro.org>
Move __rcu_read_lock() from kernel/rcupdate.c to include/linux/rcupdate.h,
allowing the compiler to inline it.
Suggested-by: Linus Torvalds <torva...@linux-foundation.org>
Signed-off-by: Paul E. McKenney <paul.mcken...@linaro.org>
Signed-off-by: Paul E. McKenney <paul...@linux.vnet.ibm.com>
---
include/linux/rcupdate.h | 13 ++++++++++++-
kernel/rcupdate.c | 12 ------------
2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 89f7e97..9967b2b 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -43,6 +43,7 @@
#include <linux/completion.h>
#include <linux/debugobjects.h>
#include <linux/compiler.h>
+#include <linux/percpu.h>
#ifdef CONFIG_RCU_TORTURE_TEST
extern int rcutorture_runnable; /* for sysctl */
@@ -150,7 +151,17 @@ DECLARE_PER_CPU(int, rcu_read_unlock_special);
DECLARE_PER_CPU(struct task_struct *, rcu_current_task);
#endif /* #ifdef CONFIG_PROVE_RCU */
-extern void __rcu_read_lock(void);
+/*
+ * Preemptible-RCU implementation for rcu_read_lock(). Just increment
+ * the per-CPU rcu_read_lock_nesting: Shared state and per-task state will
+ * be updated if we block.
+ */
+static inline void __rcu_read_lock(void)
+{
+ __this_cpu_inc(rcu_read_lock_nesting);
+ barrier(); /* Keep code within RCU read-side critical section. */
+}
+
extern void __rcu_read_unlock(void);
void synchronize_rcu(void);
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index f77a5fc..d52c68e 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -59,18 +59,6 @@ DEFINE_PER_CPU(struct task_struct *, rcu_current_task);
#endif /* #ifdef CONFIG_PROVE_RCU */
/*
- * Preemptible-RCU implementation for rcu_read_lock(). Just increment
- * the per-CPU rcu_read_lock_nesting: Shared state and per-task state will
- * be updated if we block.
- */
-void __rcu_read_lock(void)
-{
- __this_cpu_inc(rcu_read_lock_nesting);
- barrier(); /* Keep code within RCU read-side critical section. */
-}
-EXPORT_SYMBOL_GPL(__rcu_read_lock);
-
-/*
* Tree-preemptible RCU implementation for rcu_read_unlock().
* Decrement rcu_read_lock_nesting. If the result is zero (outermost
* rcu_read_unlock()) and rcu_read_unlock_special is non-zero, then
--
1.7.8
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/