Miscellaneous fixes for 3.15
Subsystems (6)
cover Miscellaneous fixes for 3.15
Hello!
This series provides miscellaneous fixes;
1. Add ACCESS_ONCE() to uses of ->n_force_qs_lh.
2. Stop tracking FSF's postal address.
3. Remove ACCESS_ONCE() from the volatile-declared jiffies.
4. Glue ASCII strings together, courtesy of Joe Perches.
5. Indentation and spacing fixes, courtesy of Joe Perches.
6. Define rcu_assign_pointer() in terms of Peter Zijlstra's shiny
new smp_store_release().
7. Disambiguate CONFIG_RCU_NOCB_CPUs, courtesy of Paul Bolle.
8. Move SRCU work to power-efficient workqueue, courtesy of
Shaibal Dutta.
9-12. Downgrade rcu_dereference_raw() to rcu_access_pointer() in
cases where there is no subsequent dereferencing.
Thanx, Paul
------------------------------------------------------------------------
b/block/blk-cgroup.c | 2 - b/block/blk-ioc.c | 2 - b/fs/file.c | 2 - b/include/linux/rculist.h | 17 ++++----- b/include/linux/rcupdate.h | 4 +- b/include/linux/rcutiny.h | 4 +- b/include/linux/rcutree.h | 4 +- b/include/linux/srcu.h | 4 +- b/kernel/ksysfs.c | 2 + b/kernel/notifier.c | 2 - b/kernel/rcu/rcu.h | 4 +- b/kernel/rcu/srcu.c | 4 +- b/kernel/rcu/tiny.c | 4 +- b/kernel/rcu/tiny_plugin.h | 4 +- b/kernel/rcu/torture.c | 4 +- b/kernel/rcu/tree.c | 4 +- b/kernel/rcu/tree.h | 4 +- b/kernel/rcu/tree_plugin.h | 4 +- b/kernel/rcu/tree_trace.c | 2 - b/kernel/rcu/update.c | 4 +- include/linux/rcupdate.h | 82 ++++++++++++++++++++------------------------- kernel/rcu/rcu.h | 2 - kernel/rcu/srcu.c | 5 +- kernel/rcu/torture.c | 4 +- kernel/rcu/tree.c | 10 ++--- kernel/rcu/tree_plugin.h | 2 - kernel/rcu/tree_trace.c | 4 +- 27 files changed, 92 insertions(+), 98 deletions(-)
PATCH 9/12 fs: Substitute rcu_access_pointer() for rcu_dereference_raw()
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
(Trivial patch.)
If the code is looking at the RCU-protected pointer itself, but not dereferencing it, the rcu_dereference() functions can be downgraded to rcu_access_pointer(). This commit makes this downgrade in __alloc_fd(), which simply compares the RCU-protected pointer against NULL with no dereferencing.
--- fs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/file.c +1 -1
@@ -497,7 +497,7 @@ repeat: error = fd;#if 1 /* Sanity check */ -if (rcu_dereference_raw (fdt->fd[fd]) !=NULL ) { +if (rcu_access_pointer (fdt->fd[fd]) !=NULL ) {printk (KERN_WARNING "alloc_fd: slot %d not NULL!\n" , fd);rcu_assign_pointer (fdt->fd[fd],NULL ); }
Signature · 1 line
1.8.1.5
PATCH 6/12 rcu: Define rcu_assign_pointer() in terms of smp_store_release()
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
The new smp_store_release() function provides better guarantees than did rcu_assign_pointer(), and potentially less overhead on some architectures. The guarantee that smp_store_release() provides that rcu_assign_pointer() does that is obscure, but its lack could cause considerable confusion. This guarantee is illustrated by the following code fragment:
struct foo {
int a;
int b;
int c;
struct foo *next;
};
struct foo foo1;
struct foo foo2;
struct foo __rcu *foop;
...
foo2.a = 1;
foo2.b = 2;
BUG_ON(foo2.c);
rcu_assign_pointer(foop, &foo);
...
fp = rcu_dereference(foop);
fp.c = 3;The current rcu_assign_pointer() semantics permit the BUG_ON() to trigger because rcu_assign_pointer()'s smp_wmb() is not guaranteed to order prior reads against later writes. This commit therefore upgrades rcu_assign_pointer() from smp_wmb() to smp_store_release() to avoid this counter-intuitive outcome.
--- include/linux/rcupdate.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
include/linux/rcupdate.h +2 -6
@@ -44,6 +44,7 @@#include <linux/debugobjects.h> #include <linux/bug.h> #include <linux/compiler.h> +#include <asm/barrier.h> #ifdef CONFIG_RCU_TORTURE_TEST extern int rcutorture_runnable;/* for sysctl */
@@ -580,12 +581,7 @@ static inline void rcu_preempt_sleep_check(void)* please be careful when making changes to rcu_assign_pointer() and the * other macros that it invokes. */ -#define rcu_assign_pointer (p, v) \ - do { \ - smp_wmb(); \ - ACCESS_ONCE(p) = RCU_INITIALIZER(v); \ - } while (0) - +#define rcu_assign_pointer (p, v) smp_store_release(&p, RCU_INITIALIZER(v))/** * rcu_access_pointer() - fetch RCU pointer with no dereferencing
Signature · 1 line
1.8.1.5
PATCH 4/12 rcu: Glue ASCII strings together
In reply to Paul E. McKenneyFrom: Joe Perches <[email protected]>
Split strings make it difficult to find the code that resulted in a given console message, so this commit glues split strings back together despite the resulting long lines.
--- include/linux/rcupdate.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
include/linux/rcupdate.h +5 -10
@@ -479,11 +479,9 @@ static inline void rcu_preempt_sleep_check(void)do { \rcu_preempt_sleep_check (); \rcu_lockdep_assert (!lock_is_held (&rcu_bh_lock_map), \ -"Illegal context switch in RCU-bh" \ -" read-side critical section" ); \ +"Illegal context switch in RCU-bh read-side critical section" ); \rcu_lockdep_assert (!lock_is_held (&rcu_sched_lock_map), \ -"Illegal context switch in RCU-sched" \ -" read-side critical section" ); \ +"Illegal context switch in RCU-sched read-side critical section" ); \ }while (0 ) #else /* #ifdef CONFIG_PROVE_RCU */
@@ -518,16 +516,14 @@ static inline void rcu_preempt_sleep_check(void)#define __rcu_dereference_check (p, c, space) \ ({ \ typeof(*p) *_________p1 = (typeof(*p)*__force )ACCESS_ONCE(p); \ - rcu_lockdep_assert(c, "suspicious rcu_dereference_check()" \ - " usage"); \ + rcu_lockdep_assert(c, "suspicious rcu_dereference_check() usage"); \ rcu_dereference_sparse(p, space); \ smp_read_barrier_depends(); \ ((typeof(*p) __force __kernel *)(_________p1)); \ })#define __rcu_dereference_protected (p, c, space) \ ({ \ - rcu_lockdep_assert(c, "suspicious rcu_dereference_protected()" \ - " usage"); \ + rcu_lockdep_assert(c, "suspicious rcu_dereference_protected() usage"); \ rcu_dereference_sparse(p, space); \ ((typeof(*p) __force __kernel *)(p)); \ })
@@ -542,8 +538,7 @@ static inline void rcu_preempt_sleep_check(void) ({ \typeof (p) _________p1 =ACCESS_ONCE (p); \rcu_lockdep_assert (c, \ -"suspicious rcu_dereference_index_check()" \ -" usage" ); \ +"suspicious rcu_dereference_index_check() usage" ); \smp_read_barrier_depends (); \ (_________p1); \ })
Signature · 1 line
1.8.1.5
PATCH 2/12 rcu: Stop tracking FSF's postal address
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
All of the RCU source files have the usual GPL header, which contains a long-obsolete postal address for FSF. To avoid the need to track the FSF office's movements, this commit substitutes the URL where GPL may be found.
--- include/linux/rcupdate.h | 4 ++-- include/linux/rcutiny.h | 4 ++-- include/linux/rcutree.h | 4 ++-- include/linux/srcu.h | 4 ++-- kernel/rcu/rcu.h | 4 ++-- kernel/rcu/srcu.c | 4 ++-- kernel/rcu/tiny.c | 4 ++-- kernel/rcu/tiny_plugin.h | 4 ++-- kernel/rcu/torture.c | 4 ++-- kernel/rcu/tree.c | 4 ++-- kernel/rcu/tree.h | 4 ++-- kernel/rcu/tree_plugin.h | 4 ++-- kernel/rcu/tree_trace.c | 4 ++-- kernel/rcu/update.c | 4 ++-- 14 files changed, 28 insertions(+), 28 deletions(-)
include/linux/rcupdate.h +2 -2
@@ -12,8 +12,8 @@* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* along with this program; if not, you can access it online at +* http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright IBM Corporation, 2001 *
include/linux/rcutiny.h +2 -2
@@ -12,8 +12,8 @@* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* along with this program; if not, you can access it online at +* http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright IBM Corporation, 2008 *
include/linux/rcutree.h +2 -2
@@ -12,8 +12,8 @@* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* along with this program; if not, you can access it online at +* http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright IBM Corporation, 2008 *
include/linux/srcu.h +2 -2
@@ -12,8 +12,8 @@* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* along with this program; if not, you can access it online at +* http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright (C) IBM Corporation, 2006 * Copyright (C) Fujitsu, 2012
kernel/rcu/rcu.h +2 -2
@@ -12,8 +12,8 @@* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* along with this program; if not, you can access it online at +* http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright IBM Corporation, 2011 *
kernel/rcu/srcu.c +2 -2
@@ -12,8 +12,8 @@* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* along with this program; if not, you can access it online at +* http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright (C) IBM Corporation, 2006 * Copyright (C) Fujitsu, 2012
kernel/rcu/tiny.c +2 -2
@@ -12,8 +12,8 @@* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* along with this program; if not, you can access it online at +* http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright IBM Corporation, 2008 *
kernel/rcu/tiny_plugin.h +2 -2
@@ -14,8 +14,8 @@* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* along with this program; if not, you can access it online at +* http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright (c) 2010 Linaro *
kernel/rcu/torture.c +2 -2
@@ -12,8 +12,8 @@* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* along with this program; if not, you can access it online at +* http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright (C) IBM Corporation, 2005, 2006 *
kernel/rcu/tree.c +2 -2
@@ -12,8 +12,8 @@* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* along with this program; if not, you can access it online at +* http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright IBM Corporation, 2008 *
kernel/rcu/tree.h +2 -2
@@ -13,8 +13,8 @@* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* along with this program; if not, you can access it online at +* http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright IBM Corporation, 2008 *
kernel/rcu/tree_plugin.h +2 -2
@@ -14,8 +14,8 @@* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* along with this program; if not, you can access it online at +* http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright Red Hat, 2009 * Copyright IBM Corporation, 2009
kernel/rcu/tree_trace.c +2 -2
@@ -12,8 +12,8 @@* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* along with this program; if not, you can access it online at +* http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright IBM Corporation, 2008 *
kernel/rcu/update.c +2 -2
@@ -12,8 +12,8 @@* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +* along with this program; if not, you can access it online at +* http://www.gnu.org/licenses/gpl-2.0.html. * * Copyright IBM Corporation, 2001 *
Signature · 1 line
1.8.1.5
PATCH 5/12 rcu: Indentation and spacing fixes.
In reply to Paul E. McKenneyFrom: Joe Perches <[email protected]>
This commit outdents expression-statement macros, thus repairing a few line-length complaints. Also fix some spacing errors called out by checkpatch.pl.
--- include/linux/rculist.h | 17 +++++++------- include/linux/rcupdate.h | 58 ++++++++++++++++++++++++------------------------ 2 files changed, 38 insertions(+), 37 deletions(-)
include/linux/rculist.h +9 -8
@@ -247,9 +247,10 @@ static inline void list_splice_init_rcu(struct list_head *list,* primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). */ #define list_entry_rcu (ptr, type, member) \ - ({typeof (*ptr) __rcu *__ptr = (typeof (*ptr) __rcu __force *)ptr; \ - container_of((typeof(ptr))rcu_dereference_raw(__ptr), type, member); \ - }) +({ \ + typeof(*ptr) __rcu *__ptr = (typeof(*ptr) __rcu __force *)ptr; \ + container_of((typeof(ptr))rcu_dereference_raw(__ptr), type, member); \ +})/** * Where are list_empty_rcu() and list_first_entry_rcu()?
@@ -285,11 +286,11 @@ static inline void list_splice_init_rcu(struct list_head *list,* primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). */ #define list_first_or_null_rcu (ptr, type, member) \ - ({struct list_head *__ptr = (ptr); \ - struct list_head *__next = ACCESS_ONCE(__ptr->next); \ - likely(__ptr != __next) ? \ - list_entry_rcu(__next, type, member) : NULL; \ - }) +({ \ + struct list_head *__ptr = (ptr); \ + struct list_head *__next = ACCESS_ONCE(__ptr->next); \ + likely(__ptr != __next) ? list_entry_rcu(__next, type, member) : NULL; \ +})/** * list_for_each_entry_rcu - iterate over rcu list of given type
include/linux/rcupdate.h +29 -29
69 lines not on this page · raw message
Signature · 1 line
1.8.1.5
PATCH 11/12 notifier: Substitute rcu_access_pointer() for rcu_dereference_raw()
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
(Trivial patch.)
If the code is looking at the RCU-protected pointer itself, but not dereferencing it, the rcu_dereference() functions can be downgraded to rcu_access_pointer(). This commit makes this downgrade in __blocking_notifier_call_chain() which simply compares the RCU-protected pointer against NULL with no dereferencing.
--- kernel/notifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/notifier.c +1 -1
@@ -309,7 +309,7 @@ int __blocking_notifier_call_chain(struct blocking_notifier_head *nh,* racy then it does not matter what the result of the test * is, we re-check the list after having taken the lock anyway: */ -if (rcu_dereference_raw (nh->head)) { +if (rcu_access_pointer (nh->head)) {down_read (&nh->rwsem); ret =notifier_call_chain (&nh->head, val, v, nr_to_call, nr_calls);
Signature · 1 line
1.8.1.5
PATCH 1/12 rcu: Add ACCESS_ONCE() to ->n_force_qs_lh accesses
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
The ->n_force_qs_lh field is accessed without the benefit of any synchronization, so this commit adds the needed ACCESS_ONCE() wrappers. Yes, increments to ->n_force_qs_lh can be lost, but contention should be low and the field is strictly statistical in nature, so this is not a problem.
--- kernel/rcu/tree.c | 4 ++-- kernel/rcu/tree_trace.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
kernel/rcu/tree.c +2 -2
@@ -2304,7 +2304,7 @@ static void force_quiescent_state(struct rcu_state *rsp)if (rnp_old !=NULL )raw_spin_unlock (&rnp_old->fqslock);if (ret) { - rsp->n_force_qs_lh++; +ACCESS_ONCE (rsp->n_force_qs_lh)++;return ; } rnp_old = rnp;
@@ -2316,7 +2316,7 @@ static void force_quiescent_state(struct rcu_state *rsp)smp_mb__after_unlock_lock ();raw_spin_unlock (&rnp_old->fqslock);if (ACCESS_ONCE (rsp->gp_flags) &RCU_GP_FLAG_FQS ) { - rsp->n_force_qs_lh++; +ACCESS_ONCE (rsp->n_force_qs_lh)++;raw_spin_unlock_irqrestore (&rnp_old->lock, flags);return ;/* Someone beat us to it. */ }
kernel/rcu/tree_trace.c +1 -1
@@ -273,7 +273,7 @@ static void print_one_rcu_state(struct seq_file *m, struct rcu_state *rsp)seq_printf (m,"nfqs=%lu/nfqsng=%lu(%lu) fqlh=%lu oqlen=%ld/%ld\n" , rsp->n_force_qs, rsp->n_force_qs_ngp, rsp->n_force_qs - rsp->n_force_qs_ngp, - rsp->n_force_qs_lh, rsp->qlen_lazy, rsp->qlen); +ACCESS_ONCE (rsp->n_force_qs_lh), rsp->qlen_lazy, rsp->qlen);for (rnp = &rsp->node[0 ]; rnp - &rsp->node[0 ] < rcu_num_nodes; rnp++) {if (rnp->level != level) {seq_puts (m,"\n" );
Signature · 1 line
1.8.1.5
PATCH 3/12 rcu: Remove ACCESS_ONCE() from jiffies
From: "Paul E. McKenney" <[email protected]>
Because jiffies is one of a very few variables marked "volatile", there is no need to use ACCESS_ONCE() when accessing it. This commit therefore removes the redundant ACCESS_ONCE() wrappers.
Reported by: Eric Dumazet <[email protected]>
--- kernel/rcu/torture.c | 4 ++-- kernel/rcu/tree.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
kernel/rcu/torture.c +2 -2
@@ -1352,7 +1352,7 @@ rcu_torture_shutdown(void *arg)unsigned long jiffies_snap;VERBOSE_PRINTK_STRING ("rcu_torture_shutdown task started" ); - jiffies_snap =ACCESS_ONCE (jiffies); + jiffies_snap = jiffies;while (ULONG_CMP_LT (jiffies_snap, shutdown_time) && !kthread_should_stop ()) { delta = shutdown_time - jiffies_snap;
@@ -1361,7 +1361,7 @@ rcu_torture_shutdown(void *arg)"rcu_torture_shutdown task: %lu jiffies remaining\n" , torture_type, delta);schedule_timeout_interruptible (delta); - jiffies_snap =ACCESS_ONCE (jiffies); + jiffies_snap = jiffies; }if (kthread_should_stop ()) {VERBOSE_PRINTK_STRING ("rcu_torture_shutdown task stopping" );
kernel/rcu/tree.c +3 -3
@@ -837,7 +837,7 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp,* to the next. Only do this for the primary flavor of RCU. */ if (rdp->rsp == rcu_state && -ULONG_CMP_GE (ACCESS_ONCE (jiffies), rdp->rsp->jiffies_resched)) { +ULONG_CMP_GE (jiffies, rdp->rsp->jiffies_resched)) { rdp->rsp->jiffies_resched +=5 ;resched_cpu (rdp->cpu); }
@@ -847,7 +847,7 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp,static void record_gp_stall_check_time (struct rcu_state *rsp) { -unsigned long j =ACCESS_ONCE (jiffies); +unsigned long j = jiffies;unsigned long j1; rsp->gp_start = j;
@@ -1005,7 +1005,7 @@ static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)if (rcu_cpu_stall_suppress || !rcu_gp_in_progress (rsp))return ; - j =ACCESS_ONCE (jiffies); + j = jiffies;/* * Lots of memory barriers to reject false positives.
Signature · 1 line
1.8.1.5
PATCH 12/12 rcu: Fix sparse warning for rcu_expedited from kernel/ksysfs.c
In reply to Paul E. McKenneyFrom: Paul Gortmaker <[email protected]>
This commit fixes the follwoing warning:
kernel/ksysfs.c:143:5: warning: symbol 'rcu_expedited' was not declared. Should it be static?
[ paulmck: Moved the declaration to include/linux/rcupdate.h to avoid
including the RCU-internal rcu.h file outside of RCU. ]
--- include/linux/rcupdate.h | 1 + kernel/ksysfs.c | 2 ++ kernel/rcu/rcu.h | 2 -- 3 files changed, 3 insertions(+), 2 deletions(-)
include/linux/rcupdate.h +1 -0
@@ -46,6 +46,7 @@#include <linux/compiler.h> #include <asm/barrier.h> +extern int rcu_expedited;/* for sysctl */ #ifdef CONFIG_RCU_TORTURE_TEST extern int rcutorture_runnable;/* for sysctl */ #endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
kernel/ksysfs.c +2 -0
@@ -19,6 +19,8 @@#include <linux/sched.h> #include <linux/capability.h> +#include <linux/rcupdate.h> /* rcu_expedited */ +#define KERNEL_ATTR_RO (_name) \ static struct kobj_attribute _name##_attr = __ATTR_RO(_name)
kernel/rcu/rcu.h +0 -2
@@ -116,8 +116,6 @@ static inline bool __rcu_reclaim(const char *rn, struct rcu_head *head) } } -extern int rcu_expedited; -#ifdef CONFIG_RCU_STALL_COMMON extern int rcu_cpu_stall_suppress;
Signature · 1 line
1.8.1.5
PATCH 7/12 rcu: Disambiguate CONFIG_RCU_NOCB_CPUs
In reply to Paul E. McKenneyFrom: Paul Bolle <[email protected]>
This commit fixes a grammar issue in the rcu_nohz_full_cpu() comment header, so that it is clear that the plural is CPUs not Kconfig options.
--- kernel/rcu/tree_plugin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +1 -1
@@ -2893,7 +2893,7 @@ static void rcu_sysidle_init_percpu_data(struct rcu_dynticks *rdtp)* CPU unless the grace period has extended for too long. * * This code relies on the fact that all NO_HZ_FULL CPUs are also -* CONFIG_RCU_NOCB_CPUs. +* CONFIG_RCU_NOCB_CPU CPUs. */ static bool rcu_nohz_full_cpu (struct rcu_state *rsp) {
Signature · 1 line
1.8.1.5
PATCH 10/12 block: Substitute rcu_access_pointer() for rcu_dereference_raw()
In reply to Paul E. McKenneyFrom: "Paul E. McKenney" <[email protected]>
(Trivial patch.)
If the code is looking at the RCU-protected pointer itself, but not dereferencing it, the rcu_dereference() functions can be downgraded to rcu_access_pointer(). This commit makes this downgrade in blkg_destroy() and ioc_destroy_icq(), both of which simply compare the RCU-protected pointer against another pointer with no dereferencing.
--- block/blk-cgroup.c | 2 +- block/blk-ioc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
block/blk-cgroup.c +1 -1
@@ -336,7 +336,7 @@ static void blkg_destroy(struct blkcg_gq *blkg)* under queue_lock. If it's not pointing to @blkg now, it never * will. Hint assignment itself can race safely. */ -if (rcu_dereference_raw (blkcg->blkg_hint) == blkg) +if (rcu_access_pointer (blkcg->blkg_hint) == blkg)rcu_assign_pointer (blkcg->blkg_hint,NULL );/*
block/blk-ioc.c +1 -1
@@ -68,7 +68,7 @@ static void ioc_destroy_icq(struct io_cq *icq)* under queue_lock. If it's not pointing to @icq now, it never * will. Hint assignment itself can race safely. */ -if (rcu_dereference_raw (ioc->icq_hint) == icq) +if (rcu_access_pointer (ioc->icq_hint) == icq)rcu_assign_pointer (ioc->icq_hint,NULL );ioc_exit_icq (icq);
Signature · 1 line
1.8.1.5
PATCH 8/12 rcu: Move SRCU grace period work to power efficient workqueue
In reply to Paul E. McKenneyFrom: Shaibal Dutta <[email protected]>
For better use of CPU idle time, allow the scheduler to select the CPU on which the SRCU grace period work would be scheduled. This improves idle residency time and conserves power.
This functionality is enabled when CONFIG_WQ_POWER_EFFICIENT is selected.
[[email protected]: Rebased to latest kernel version. Added commit message. Fixed code alignment.]
--- kernel/rcu/srcu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/rcu/srcu.c +3 -2
@@ -398,7 +398,7 @@ void call_srcu(struct srcu_struct *sp, struct rcu_head *head,rcu_batch_queue (&sp->batch_queue, head);if (!sp->running) { sp->running = true; -schedule_delayed_work (&sp->work,0 ); +queue_delayed_work (system_power_efficient_wq, &sp->work,0 ); }spin_unlock_irqrestore (&sp->queue_lock, flags); }
@@ -674,7 +674,8 @@ static void srcu_reschedule(struct srcu_struct *sp) }if (pending) -schedule_delayed_work (&sp->work,SRCU_INTERVAL ); +queue_delayed_work (system_power_efficient_wq, + &sp->work,SRCU_INTERVAL ); }/*
Signature · 1 line
1.8.1.5
Re: [PATCH tip/core/rcu 09/12] fs: Substitute rcu_access_pointer() for rcu_dereference_raw()
In reply to Paul E. McKenneyQuoted 10 lines · Paul E. McKenney
From: "Paul E. McKenney" <[email protected]>
(Trivial patch.)
If the code is looking at the RCU-protected pointer itself, but not dereferencing it, the
rcu_dereference()functions can be downgraded torcu_access_pointer(). This commit makes this downgrade in__alloc_fd(), which simply compares the RCU-protected pointer against NULL with no dereferencing.
Quoted 3 lines
Signed-off-by Paul E. McKenney <[email protected]>Cc Alexander Viro <[email protected]>
I'm beginning to wonder if this common pattern ought to have an rcu_pointer_is_null(), which would not return the pointer, only the boolean.
Regardless, for this patch:
Quoted 19 lines
fs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/file.c +1
-1@@ -497,7 +497,7 @@ repeat: error = fd;#if 1 /* Sanity check */ -if (rcu_dereference_raw (fdt->fd[fd]) !=NULL ) { +if (rcu_access_pointer (fdt->fd[fd]) !=NULL ) {printk (KERN_WARNING "alloc_fd: slot %d not NULL!\n" , fd);rcu_assign_pointer (fdt->fd[fd],NULL ); }Signature · 1 line
1.8.1.5
Quoted 17 lines · Paul E. McKenney
Hello!
This series provides miscellaneous fixes;
1. Add
ACCESS_ONCE()to uses of ->n_force_qs_lh.2. Stop tracking FSF's postal address.
3. Remove
ACCESS_ONCE()from the volatile-declared jiffies.4. Glue ASCII strings together, courtesy of Joe Perches.
5. Indentation and spacing fixes, courtesy of Joe Perches.
6. Define
rcu_assign_pointer()in terms of Peter Zijlstra's shiny
newsmp_store_release().
Quoted 7 lines
7. Disambiguate
CONFIG_RCU_NOCB_CPUs, courtesy of Paul Bolle.8. Move SRCU work to power-efficient workqueue, courtesy of
Shaibal Dutta.9-12. Downgrade
rcu_dereference_raw()torcu_access_pointer()in
cases where there is no subsequent dereferencing.
For all 12:
Quoted 33 lines
Thanx, Paul
------------------------------------------------------------------------
b/block/blk-cgroup.c | 2 - b/block/blk-ioc.c | 2 - b/fs/file.c | 2 - b/include/linux/rculist.h | 17 ++++----- b/include/linux/rcupdate.h | 4 +- b/include/linux/rcutiny.h | 4 +- b/include/linux/rcutree.h | 4 +- b/include/linux/srcu.h | 4 +- b/kernel/ksysfs.c | 2 + b/kernel/notifier.c | 2 - b/kernel/rcu/rcu.h | 4 +- b/kernel/rcu/srcu.c | 4 +- b/kernel/rcu/tiny.c | 4 +- b/kernel/rcu/tiny_plugin.h | 4 +- b/kernel/rcu/torture.c | 4 +- b/kernel/rcu/tree.c | 4 +- b/kernel/rcu/tree.h | 4 +- b/kernel/rcu/tree_plugin.h | 4 +- b/kernel/rcu/tree_trace.c | 2 - b/kernel/rcu/update.c | 4 +- include/linux/rcupdate.h | 82 ++++++++++++++++++++------------------------- kernel/rcu/rcu.h | 2 - kernel/rcu/srcu.c | 5 +- kernel/rcu/torture.c | 4 +- kernel/rcu/tree.c | 10 ++--- kernel/rcu/tree_plugin.h | 2 - kernel/rcu/tree_trace.c | 4 +- 27 files changed, 92 insertions(+), 98 deletions(-)
Re: [PATCH tip/core/rcu 09/12] fs: Substitute rcu_access_pointer() for rcu_dereference_raw()
In reply to Josh TriplettQuoted 11 lines · Josh Triplett
Quoted 10 lines · Paul E. McKenney
From: "Paul E. McKenney" <[email protected]>
(Trivial patch.)
If the code is looking at the RCU-protected pointer itself, but not dereferencing it, the
rcu_dereference()functions can be downgraded torcu_access_pointer(). This commit makes this downgrade in__alloc_fd(), which simply compares the RCU-protected pointer against NULL with no dereferencing.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Paul E. McKenney <[email protected]>Cc Alexander Viro <[email protected]>I'm beginning to wonder if this common pattern ought to have an
rcu_pointer_is_null(), which would not return the pointer, only the boolean.
Or perhaps an rcu_compare_pointer() to also handle the various cases like:
if (rcu_dereference_raw(foop) == barp) ...
I added the problem to the RCU cleanup list on the OPW site, and your solution or my elaboration of it might be the right thing to do. (Inspected all 1300 uses of members of the rcu_dereference() family of functions last week, and was feeling a bit buggy-eyed at the end...)
Thanx, Paul
Quoted 23 lines
Regardless, for this patch:
Reviewed-by Josh Triplett <[email protected]>Quoted 19 lines
fs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/file.c +1
-1@@ -497,7 +497,7 @@ repeat: error = fd;#if 1 /* Sanity check */ -if (rcu_dereference_raw (fdt->fd[fd]) !=NULL ) { +if (rcu_access_pointer (fdt->fd[fd]) !=NULL ) {printk (KERN_WARNING "alloc_fd: slot %d not NULL!\n" , fd);rcu_assign_pointer (fdt->fd[fd],NULL ); }Signature · 1 line
1.8.1.5
Josh Triplett
maintainerRe: [PATCH tip/core/rcu 09/12] fs: Substitute rcu_access_pointer() for rcu_dereference_raw()
Quoted 20 lines · Paul E. McKenney
Quoted 11 lines · Josh Triplett
Quoted 10 lines · Paul E. McKenney
From: "Paul E. McKenney" <[email protected]>
(Trivial patch.)
If the code is looking at the RCU-protected pointer itself, but not dereferencing it, the
rcu_dereference()functions can be downgraded torcu_access_pointer(). This commit makes this downgrade in__alloc_fd(), which simply compares the RCU-protected pointer against NULL with no dereferencing.Quoted 7 lines
Quoted 3 lines
Signed-off-by Paul E. McKenney <[email protected]>Cc Alexander Viro <[email protected]>I'm beginning to wonder if this common pattern ought to have an
rcu_pointer_is_null(), which would not return the pointer, only the boolean.
Quoted 8 lines
Or perhaps an
rcu_compare_pointer()to also handle the various cases like:if (rcu_dereference_raw(foop) == barp) ...I added the problem to the RCU cleanup list on the OPW site, and your solution or my elaboration of it might be the right thing to do. (Inspected all 1300 uses of members of the
rcu_dereference()family of functions last week, and was feeling a bit buggy-eyed at the end...)
rcu_pointer_eq and/or rcu_pointer_neq might make sense, yeah, as self-documenting versions of the most sensible way to do the operation, to steer people away from rcu_dereference or rcu_dereference_raw.
- Jsoh Triplett
Quoted 26 lines
Thanx, Paul
Quoted 23 lines
Regardless, for this patch:
Reviewed-by Josh Triplett <[email protected]>Quoted 19 lines
fs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/file.c +1
-1@@ -497,7 +497,7 @@ repeat: error = fd;#if 1 /* Sanity check */ -if (rcu_dereference_raw (fdt->fd[fd]) !=NULL ) { +if (rcu_access_pointer (fdt->fd[fd]) !=NULL ) {printk (KERN_WARNING "alloc_fd: slot %d not NULL!\n" , fd);rcu_assign_pointer (fdt->fd[fd],NULL ); }Signature · 1 line
1.8.1.5
Re: [PATCH tip/core/rcu 09/12] fs: Substitute rcu_access_pointer() for rcu_dereference_raw()
Quoted 25 lines · Josh Triplett
Quoted 24 lines · Paul E. McKenney
Quoted 11 lines · Josh Triplett
Quoted 10 lines · Paul E. McKenney
From: "Paul E. McKenney" <[email protected]>
(Trivial patch.)
If the code is looking at the RCU-protected pointer itself, but not dereferencing it, the
rcu_dereference()functions can be downgraded torcu_access_pointer(). This commit makes this downgrade in__alloc_fd(), which simply compares the RCU-protected pointer against NULL with no dereferencing.Quoted 7 lines
Quoted 3 lines
Signed-off-by Paul E. McKenney <[email protected]>Cc Alexander Viro <[email protected]>I'm beginning to wonder if this common pattern ought to have an
rcu_pointer_is_null(), which would not return the pointer, only the boolean.Or perhaps an
rcu_compare_pointer()to also handle the various cases like:if (rcu_dereference_raw(foop) == barp) ...
Quoted 8 lines
Quoted 4 lines
I added the problem to the RCU cleanup list on the OPW site, and your solution or my elaboration of it might be the right thing to do. (Inspected all 1300 uses of members of the
rcu_dereference()family of functions last week, and was feeling a bit buggy-eyed at the end...)
rcu_pointer_eqand/orrcu_pointer_neqmight make sense, yeah, as self-documenting versions of the most sensible way to do the operation, to steer people away fromrcu_dereferenceorrcu_dereference_raw.
Good point! I added this to http://kernelnewbies.org/OPWIntro-RCU?action=show,
crediting you for the idea.
Thanx, Paul
Quoted 29 lines
- Jsoh Triplett
Quoted 26 lines
Thanx, Paul
Quoted 23 lines
Regardless, for this patch:
Reviewed-by Josh Triplett <[email protected]>Quoted 19 lines
fs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/file.c +1
-1@@ -497,7 +497,7 @@ repeat: error = fd;#if 1 /* Sanity check */ -if (rcu_dereference_raw (fdt->fd[fd]) !=NULL ) { +if (rcu_access_pointer (fdt->fd[fd]) !=NULL ) {printk (KERN_WARNING "alloc_fd: slot %d not NULL!\n" , fd);rcu_assign_pointer (fdt->fd[fd],NULL ); }Signature · 1 line
1.8.1.5
Jens Axboe
maintainerRe: [PATCH tip/core/rcu 10/12] block: Substitute rcu_access_pointer() for rcu_dereference_raw()
In reply to Paul E. McKenneyQuoted 9 lines · Paul E. McKenney
From: "Paul E. McKenney" <[email protected]>
(Trivial patch.)
If the code is looking at the RCU-protected pointer itself, but not dereferencing it, the
rcu_dereference()functions can be downgraded torcu_access_pointer(). This commit makes this downgrade inblkg_destroy()andioc_destroy_icq(), both of which simply compare the RCU-protected pointer against another pointer with no dereferencing.
Thanks Paul, applied.
Signature · 1 line
Jens Axboe