From a50656778084c833278ecd55ee1d9604ffb3c643 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Mon, 15 May 2006 09:43:58 -0700 Subject: [PATCH] --- yaml --- r: 26701 b: refs/heads/master c: 986733e01d258c26107f1da9d8d47c718349ad2f h: refs/heads/master i: 26699: 1296c40752aa3e871a42f80e08467b1ae9da6bf2 v: v3 --- [refs] | 2 +- trunk/include/linux/rcupdate.h | 1 + trunk/kernel/rcupdate.c | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 70e8aea3173b..cbf7feda4479 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3b7c8108273bed41a2fc04533cc9f2026ff38c8e +refs/heads/master: 986733e01d258c26107f1da9d8d47c718349ad2f diff --git a/trunk/include/linux/rcupdate.h b/trunk/include/linux/rcupdate.h index 5673008b61e1..970284f571a6 100644 --- a/trunk/include/linux/rcupdate.h +++ b/trunk/include/linux/rcupdate.h @@ -132,6 +132,7 @@ static inline void rcu_bh_qsctr_inc(int cpu) } extern int rcu_pending(int cpu); +extern int rcu_needs_cpu(int cpu); /** * rcu_read_lock - mark the beginning of an RCU read-side critical section. diff --git a/trunk/kernel/rcupdate.c b/trunk/kernel/rcupdate.c index 6d32ff26f948..2058f88c7bbb 100644 --- a/trunk/kernel/rcupdate.c +++ b/trunk/kernel/rcupdate.c @@ -479,12 +479,31 @@ static int __rcu_pending(struct rcu_ctrlblk *rcp, struct rcu_data *rdp) return 0; } +/* + * Check to see if there is any immediate RCU-related work to be done + * by the current CPU, returning 1 if so. This function is part of the + * RCU implementation; it is -not- an exported member of the RCU API. + */ int rcu_pending(int cpu) { return __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu)) || __rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu)); } +/* + * Check to see if any future RCU-related work will need to be done + * by the current CPU, even if none need be done immediately, returning + * 1 if so. This function is part of the RCU implementation; it is -not- + * an exported member of the RCU API. + */ +int rcu_needs_cpu(int cpu) +{ + struct rcu_data *rdp = &per_cpu(rcu_data, cpu); + struct rcu_data *rdp_bh = &per_cpu(rcu_bh_data, cpu); + + return (!!rdp->curlist || !!rdp_bh->curlist || rcu_pending(cpu)); +} + void rcu_check_callbacks(int cpu, int user) { if (user ||