RCU head debug objects
Subsystems (16)
Mathieu Desnoyers
reviewercover RCU head debug objects
Hi,
This patchset introduces a debugobjects-based rcu list head debugging infrastructure. The first patch adds the ability to keep track of a "state machine" into debugobjects. The state machine logic is all contained in the type-aware caller. Debugobjects only keep track of the current state (a single integer). A state validation/transition API is provided to debugobjects users.
This patchset is based on 2.6.33.1.
Comments are welcome,
Mathieu
Signature · 2 lines
Mathieu Desnoyers OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
Mathieu Desnoyers
reviewerRFC PATCH 1/3 Debugobjects transition check
Implement a basic state machine checker in the debugobjects.
--- include/linux/debugobjects.h | 9 ++++++ lib/debugobjects.c | 59 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 65 insertions(+), 3 deletions(-)
include/linux/debugobjects.h +9 -0
@@ -20,12 +20,14 @@ struct debug_obj_descr;* struct debug_obj - representaion of an tracked object * @node: hlist node to link the object into the tracker list * @state: tracked object state +* @astate: current active state * @object: pointer to the real object * @descr: pointer to an object type specific debug description structure */ struct debug_obj {struct hlist_node node;enum debug_obj_state state; +unsigned int astate;void *object;struct debug_obj_descr *descr; };
@@ -60,6 +62,13 @@ extern void debug_object_deactivate(voidextern void debug_object_destroy (void *addr,struct debug_obj_descr *descr);extern void debug_object_free (void *addr,struct debug_obj_descr *descr); +/* +* Active state must return to 0 before deactivation. +*/ +extern void +debug_object_active_state (void *addr,struct debug_obj_descr *descr, +unsigned int expect,unsigned int next); +extern void debug_objects_early_init (void );extern void debug_objects_mem_init (void );#else
lib/debugobjects.c +56 -3
83 lines not on this page · raw message
Signature · 2 lines
Mathieu Desnoyers OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
Mathieu Desnoyers
reviewerRFC PATCH 2/3 tree/tiny rcu: Add debug RCU head objects (v3)
In reply to Mathieu DesnoyersHelps finding racy users of call_rcu(), which results in hangs because list entries are overwritten and/or skipped.
This new patch version is based on the debugobjects with the newly introduced "active state" tracker.
Non-initialized entries are all considered as "statically initialized". An activation fixup (triggered by call_rcu()) takes care of performing the debug object initialization without issuing any warning. Since we cannot increase the size of struct rcu_head, I don't see much room to put an identifier for statically initialized rcu_head structures. So for now, we have to live without "activation without explicit init" detection. But the main purpose of this debug option is to detect double-activations (double call_rcu() use of a rcu_head before the callback is executed), which is correctly addressed here.
This also detects potential internal RCU callback corruption, which would cause the callbacks to be executed twice.
--- include/linux/rcupdate.h | 61 ++++++++++++++++++- kernel/rcupdate.c | 148 +++++++++++++++++++++++++++++++++++++++++++++++ kernel/rcutiny.c | 2 kernel/rcutree.c | 2 lib/Kconfig.debug | 6 + 5 files changed, 215 insertions(+), 4 deletions(-)
include/linux/rcupdate.h +57 -4
@@ -40,6 +40,7 @@#include <linux/seqlock.h> #include <linux/lockdep.h> #include <linux/completion.h> +#include <linux/debugobjects.h> /** * struct rcu_head - callback structure for use with RCU
@@ -71,11 +72,26 @@ extern void rcu_init(void);#error "Unknown RCU implementation specified to kernel configuration"#endif +/* For dynamic initialization of rcu_head allocated in memory */ +extern void rcu_head_init (struct rcu_head *head); + +/* For static initialization of rcu_head */ #define RCU_HEAD_INIT { .next = NULL, .func = NULL } -#define RCU_HEAD (head) struct rcu_head head = RCU_HEAD_INIT -#define INIT_RCU_HEAD (ptr) do { \ - (ptr)->next = NULL; (ptr)->func = NULL; \ -} while (0) + +/* For dynamic initialization and destruction of rcu_head on the stack */ +#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD +extern void rcu_head_init_on_stack (struct rcu_head *head); +extern void destroy_rcu_head_on_stack (struct rcu_head *head); +#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ +static inline void rcu_head_init_on_stack (struct rcu_head *head) +{ +rcu_head_init (head); +} + +static inline void destroy_rcu_head_on_stack (struct rcu_head *head) +{ +} +#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ #ifdef CONFIG_DEBUG_LOCK_ALLOC extern struct lockdep_map rcu_lock_map;
@@ -299,4 +315,41 @@ extern void call_rcu(struct rcu_head *heextern void call_rcu_bh (struct rcu_head *head,void (*func)(struct rcu_head *head)); +/* +* debug_rcu_head_queue()/debug_rcu_head_unqueue() are used internally +* by call_rcu() and rcu callback execution, and are therefore not part of the +* RCU API. Leaving in rcupdate.h because they are used by all RCU flavors. +*/ + +#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD +# define STATE_RCU_HEAD_READY 0 +# define STATE_RCU_HEAD_QUEUED 1 + +extern struct debug_obj_descr rcuhead_debug_descr; + +static inline void debug_rcu_head_queue (struct rcu_head *head) +{ +debug_object_activate (head, &rcuhead_debug_descr); +debug_object_active_state (head, &rcuhead_debug_descr, +STATE_RCU_HEAD_READY , +STATE_RCU_HEAD_QUEUED ); +} + +static inline void debug_rcu_head_unqueue (struct rcu_head *head) +{ +debug_object_active_state (head, &rcuhead_debug_descr, +STATE_RCU_HEAD_QUEUED , +STATE_RCU_HEAD_READY ); +debug_object_deactivate (head, &rcuhead_debug_descr); +} +#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ +static inline void debug_rcu_head_queue (struct rcu_head *head) +{ +} + +static inline void debug_rcu_head_unqueue (struct rcu_head *head) +{ +} +#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ +#endif /* __LINUX_RCUPDATE_H */
kernel/rcutree.c +2 -0
@@ -1060,6 +1060,7 @@ static void rcu_do_batch(struct rcu_stat next = list->next;prefetch (next);trace_rcu_tree_callback (list); +debug_rcu_head_unqueue (list); list->func (list); list = next;if (++count >= rdp->blimit)
@@ -1350,6 +1351,7 @@ __call_rcu(struct rcu_head *head, void (unsigned long flags;struct rcu_data *rdp; +debug_rcu_head_queue (head); head->func = func; head->next =NULL ;
lib/Kconfig.debug +6 -0
@@ -306,6 +306,12 @@ config DEBUG_OBJECTS_WORK work queue routines to track the life time of work objects and validate the work operations. +config DEBUG_OBJECTS_RCU_HEAD + bool "Debug RCU callbacks objects" + depends on DEBUG_OBJECTS + help + Enable this to turn on debugging of RCU list heads (call_rcu() usage). + config DEBUG_OBJECTS_ENABLE_DEFAULT int "debug_objects bootup default value (0-1)" range 0 1
kernel/rcutiny.c +2 -0
@@ -163,6 +163,7 @@ static void __rcu_process_callbacks(struwhile (list) { next = list->next;prefetch (next); +debug_rcu_head_unqueue (list); list->func (list); list = next; }
@@ -210,6 +211,7 @@ static void __call_rcu(struct rcu_head * {unsigned long flags; +debug_rcu_head_queue (head); head->func = func; head->next =NULL ;
kernel/rcupdate.c +148 -0
151 lines not on this page · raw message
Signature · 2 lines
Mathieu Desnoyers OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
Re: [RFC patch 2/3] tree/tiny rcu: Add debug RCU head objects (v3)
Quoted 15 lines · Mathieu Desnoyers
Helps finding racy users of
call_rcu(), which results in hangs because list entries are overwritten and/or skipped.This new patch version is based on the debugobjects with the newly introduced "active state" tracker.
Non-initialized entries are all considered as "statically initialized". An activation fixup (triggered by
call_rcu()) takes care of performing the debug object initialization without issuing any warning. Since we cannot increase the size of structrcu_head, I don't see much room to put an identifier for statically initializedrcu_headstructures. So for now, we have to live without "activation without explicit init" detection. But the main purpose of this debug option is to detect double-activations (doublecall_rcu()use of arcu_headbefore the callback is executed), which is correctly addressed here.
Quoted 2 lines
This also detects potential internal RCU callback corruption, which would cause the callbacks to be executed twice.
Is this useful?
Basic usage is so there no double call_rcu():
if (atomic_dec_and_test()) call_rcu()
Re: [RFC patch 2/3] tree/tiny rcu: Add debug RCU head objects (v3)
Quoted 19 lines · Alexey Dobriyan
Quoted 15 lines · Mathieu Desnoyers
Helps finding racy users of
call_rcu(), which results in hangs because list entries are overwritten and/or skipped.This new patch version is based on the debugobjects with the newly introduced "active state" tracker.
Non-initialized entries are all considered as "statically initialized". An activation fixup (triggered by
call_rcu()) takes care of performing the debug object initialization without issuing any warning. Since we cannot increase the size of structrcu_head, I don't see much room to put an identifier for statically initializedrcu_headstructures. So for now, we have to live without "activation without explicit init" detection. But the main purpose of this debug option is to detect double-activations (doublecall_rcu()use of arcu_headbefore the callback is executed), which is correctly addressed here.Quoted 2 lines
This also detects potential internal RCU callback corruption, which would cause the callbacks to be executed twice.
Quoted 6 lines
Is this useful?
Basic usage is so there no double
call_rcu():if (atomic_dec_and_test()) call_rcu()
I believe that it is. There have been a few cases of call_rcu() being invoked twice without a grace period between the two invocations. Mathieu's patch would catch this sort of misbehavior.
That said, I do agree that if everyone followed the rules, there would be no need for Mathieu's patch -- and there would be no need for much else, besides. ;-)
Thanx, Paul
Re: [RFC patch 2/3] tree/tiny rcu: Add debug RCU head objects (v3)
In reply to Mathieu DesnoyersVery nice you do not touch struct rcu_head.
Quoted 12 lines · Mathieu Desnoyers
include/linux/rcupdate.h +12
-0+ +#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD +# define STATE_RCU_HEAD_READY 0 +# define STATE_RCU_HEAD_QUEUED 1 + +extern struct debug_obj_descr rcuhead_debug_descr; + +static inline void debug_rcu_head_queue (struct rcu_head *head) +{ +debug_object_activate (head, &rcuhead_debug_descr); + debug_object_active_state(head, &rcuhead_debug_descr, + STATE_RCU_HEAD_READY,
include/linux/rcupdate.h extern void call_rcu(struct rcu_head *he · line 344
Quoted 10 lines
include/linux/rcupdate.h +10
-0+ STATE_RCU_HEAD_QUEUED); +} + +static inline void debug_rcu_head_unqueue (struct rcu_head *head) +{ +debug_object_active_state (head, &rcuhead_debug_descr, +STATE_RCU_HEAD_QUEUED , +STATE_RCU_HEAD_READY ); +debug_object_deactivate (head, &rcuhead_debug_descr); +}
I'm a little foolish. I don't know why we need
STATE_RCU_HEAD_READY/QUEUED.
1) obj->astate does not be set to STATE_RCU_HEAD_READY in debug_object_activate/init().
Maybe you need to add a function:debug_object_activate_with_astate(head, descr, init_astate); (the same as debug_object_activate(), but init obj->astate also)
Or you need:
@debugobjects.h
# define DEBUG_OBJECT_ASTATE_INIT 0 @rcupdate.c # define STATE_RCU_HEAD_READY DEBUG_OBJECT_ASTATE_INIT # define STATE_RCU_HEAD_QUEUED (STATE_RCU_HEAD_READY + 1)
2) In debug_rcu_head_queue(), debug_object_active_state() is always success when debug_object_activate() is success.
In debug_rcu_head_unqueue(), debug_object_active_state() is always success if RCU subsystem is running correctly.
(Correct me if I'm wrong) So we don't need debug_object_active_state() here if we just find racy users of call_rcu().
Quoted 7 lines
+ */
kernel/rcupdate.c +6
-0+static int rcuhead_fixup_init (void *addr,enum debug_obj_state state) +{ +struct rcu_head *head = addr; + +switch (state) { +case ODEBUG_STATE_ACTIVE :
kernel/rcupdate.c void wakeme_after_rcu(struct rcu_head * · line 97
Quoted 10 lines
kernel/rcupdate.c +10
-0+/* +* Ensure that queued callbacks are all executed. +* If we detect that we are nested in a RCU read-side critical +* section, we should simply fail, otherwise we would deadlock. +*/ +if (rcu_preempt_depth () !=0 ||preempt_count () !=0 || +irqs_disabled ()) { +WARN_ON (1 ); +return 0 ; + }
preempt_count() != 0 ??? What happen when !CONFIG_PREEMPT?
Review
Quoted 1 line
(quoted diff) +1
-0+ rcu_barrier();
We may need call rcu_barrier(), rcu_barrier_sched(), rcu_barrier_bh() together? rcu_barrier() does not ensure to flush callbacks of RCU_BH, RCU_SCHED.
Quoted 7 lines
kernel/rcupdate.c +7
-0+debug_object_init (head, &rcuhead_debug_descr); +return 1 ; +default : +return 0 ; + } +} +
Mathieu Desnoyers
reviewerRe: [RFC patch 2/3] tree/tiny rcu: Add debug RCU head objects (v3)
Quoted 30 lines · * Lai Jiangshan ([email protected]) wrote:
Very nice you do not touch struct
rcu_head.Quoted 12 lines · Mathieu Desnoyers
include/linux/rcupdate.h +12
-0+ +#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD +# define STATE_RCU_HEAD_READY 0 +# define STATE_RCU_HEAD_QUEUED 1 + +extern struct debug_obj_descr rcuhead_debug_descr; + +static inline void debug_rcu_head_queue (struct rcu_head *head) +{ +debug_object_activate (head, &rcuhead_debug_descr); + debug_object_active_state(head, &rcuhead_debug_descr, + STATE_RCU_HEAD_READY,include/linux/rcupdate.h extern void call_rcu(struct rcu_head *he · line 344
Quoted 10 lines
include/linux/rcupdate.h +10
-0+ STATE_RCU_HEAD_QUEUED); +} + +static inline void debug_rcu_head_unqueue (struct rcu_head *head) +{ +debug_object_active_state (head, &rcuhead_debug_descr, +STATE_RCU_HEAD_QUEUED , +STATE_RCU_HEAD_READY ); +debug_object_deactivate (head, &rcuhead_debug_descr); +}I'm a little foolish. I don't know why we need
STATE_RCU_HEAD_READY/QUEUED.
Quoted 2 lines
1)
obj->astatedoes not be set toSTATE_RCU_HEAD_READYin debug_object_activate/init().
Yes it is. astate is set to 0 upon activation, and STATE_RCU_HEAD_READY is 0. This is the initial state of the state machine (and also the accepting state). Maybe I could document it a little bit more. Will write:
+/*
+ * Active state:
+ * - Set at 0 upon initialization.
+ * - Must return to 0 before deactivation.
+ */
+extern void
+debug_object_active_state(void *addr, struct debug_obj_descr *descr,
+ unsigned int expect, unsigned int next);
+
Quoted 12 lines
Maybe you need to add a function:
debug_object_activate_with_astate(head, descr, init_astate); (the same asdebug_object_activate(), but initobj->astatealso)Or you need:
@debugobjects.h# define DEBUG_OBJECT_ASTATE_INIT 0 @rcupdate.c # define STATE_RCU_HEAD_READY DEBUG_OBJECT_ASTATE_INIT # define STATE_RCU_HEAD_QUEUED (STATE_RCU_HEAD_READY + 1)
Quoted 8 lines
2) In
debug_rcu_head_queue(),debug_object_active_state()is always success whendebug_object_activate()is success.In
debug_rcu_head_unqueue(),debug_object_active_state()is always success if RCU subsystem is running correctly.(Correct me if I'm wrong) So we don't need
debug_object_active_state()here if we just find racy users ofcall_rcu().
Yes, but this debug infrastructure also detects problems that may arise in the RCU subsystem itself: e.g. a rcu head that would be executed on two CPUs, which could be caused by races between cpu hotplug and the RCU subsystem. I'm not saying that we have these races currently, but that the RCU subsystems is now so tied to complex parts of the kernel (scheduler, cpu hotplug) that it's bound to have nasty bugs eventually.
So without the state machine, what we don't have in debugobjects is the ability to detect a second "deactivation": debugobjects considers that an object can be deactivated more than once without error. But in this case, just one deactivation should be allowed. I thought that this state machine scheme would allow following an object life more closely than just the init/activate/deactivate/destroy/free phases. Maybe there could be ways to combine the calls ? But.. given that it's for debugging purposes, do we care that much about performance that it's worth creating new API members, making the API more obscure ?
Quoted 12 lines
Quoted 12 lines
+ */
kernel/rcupdate.c +10
-0+static int rcuhead_fixup_init (void *addr,enum debug_obj_state state) +{ +struct rcu_head *head = addr; + +switch (state) { +case ODEBUG_STATE_ACTIVE : +/* +* Ensure that queued callbacks are all executed. +* If we detect that we are nested in a RCU read-side critical +* section, we should simply fail, otherwise we would deadlock.
Quoted 8 lines
kernel/rcupdate.c void wakeme_after_rcu(struct rcu_head * · line 97
Quoted 6 lines
kernel/rcupdate.c +6
-0+*/ +if (rcu_preempt_depth () !=0 ||preempt_count () !=0 || +irqs_disabled ()) { +WARN_ON (1 ); +return 0 ; + }
preempt_count()!= 0 ??? What happen when !CONFIG_PREEMPT?
Will change for:
#ifndef CONFIG_PREEMPT
WARN_ON(1);
return 0;
#else
if (rcu_preempt_depth() != 0 || preempt_count() != 0 ||
irqs_disabled()) {
WARN_ON(1);
return 0;
}
rcu_barrier();
rcu_barrier_sched();
rcu_barrier_bh();
debug_object_activate(head, &rcuhead_debug_descr);
return 1;#endif
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +1
-0+ rcu_barrier();We may need call
rcu_barrier(),rcu_barrier_sched(),rcu_barrier_bh()together?rcu_barrier()does not ensure to flush callbacks ofRCU_BH,RCU_SCHED.
Right, will do.
Thanks,
Mathieu
Quoted 9 lines
Quoted 8 lines
kernel/rcupdate.c +7
-0+debug_object_init (head, &rcuhead_debug_descr); +return 1 ; +default : +return 0 ; + } +} +
Signature · 4 lines
Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com
Mathieu Desnoyers
reviewerRFC PATCH 3/3 kernel call_rcu usage: initialize rcu_head structures
In reply to Mathieu DesnoyersInitialize rcu_head structures with rcu_head_init() before passing them to call_rcu().
--- block/cfq-iosched.c | 2 +- block/genhd.c | 2 +- fs/file.c | 4 ++-- fs/fs-writeback.c | 13 +++++++++---- fs/partitions/check.c | 2 +- kernel/fork.c | 1 + kernel/pid.c | 1 + kernel/rcutiny.c | 6 ++++++ kernel/rcutorture.c | 2 ++ kernel/rcutree.c | 4 ++++ mm/backing-dev.c | 2 +- mm/slob.c | 2 +- net/core/drop_monitor.c | 2 +- net/ipv6/sit.c | 2 +- net/ipv6/xfrm6_tunnel.c | 2 +- net/netfilter/nf_conntrack_expect.c | 2 +- net/netfilter/nf_conntrack_extend.c | 2 +- net/netfilter/nfnetlink_queue.c | 2 +- net/netlabel/netlabel_domainhash.c | 2 +- net/netlabel/netlabel_unlabeled.c | 6 +++--- net/sctp/bind_addr.c | 2 +- net/sctp/ipv6.c | 2 +- net/sctp/protocol.c | 2 +- 23 files changed, 43 insertions(+), 24 deletions(-)
kernel/pid.c +1 -0
@@ -265,6 +265,7 @@ struct pid *alloc_pid(struct pid_namespaget_pid_ns (ns); pid->level = ns->level; +rcu_head_init (&pid->rcu);atomic_set (&pid->count,1 );for (type =0 ; type <PIDTYPE_MAX ; ++type)INIT_HLIST_HEAD (&pid->tasks[type]);
kernel/fork.c +1 -0
@@ -1062,6 +1062,7 @@ static struct task_struct *copy_process(INIT_LIST_HEAD (&p->children);INIT_LIST_HEAD (&p->sibling);rcu_copy_process (p); +rcu_head_init (&p->rcu); p->vfork_done =NULL ;spin_lock_init (&p->alloc_lock);
kernel/rcutiny.c +6 -0
@@ -246,11 +246,13 @@ void rcu_barrier(void) {struct rcu_synchronize rcu; +rcu_head_init_on_stack (&rcu.head);init_completion (&rcu.completion);/* Will wake me after RCU finished. */ call_rcu (&rcu.head, wakeme_after_rcu);/* Wait for it. */ wait_for_completion (&rcu.completion); +destroy_rcu_head_on_stack (&rcu.head); }EXPORT_SYMBOL_GPL (rcu_barrier);
@@ -258,11 +260,13 @@ void rcu_barrier_bh(void) {struct rcu_synchronize rcu; +rcu_head_init_on_stack (&rcu.head);init_completion (&rcu.completion);/* Will wake me after RCU finished. */ call_rcu_bh (&rcu.head, wakeme_after_rcu);/* Wait for it. */ wait_for_completion (&rcu.completion); +destroy_rcu_head_on_stack (&rcu.head); }EXPORT_SYMBOL_GPL (rcu_barrier_bh);
@@ -270,11 +274,13 @@ void rcu_barrier_sched(void) {struct rcu_synchronize rcu; +rcu_head_init_on_stack (&rcu.head);init_completion (&rcu.completion);/* Will wake me after RCU finished. */ call_rcu_sched (&rcu.head, wakeme_after_rcu);/* Wait for it. */ wait_for_completion (&rcu.completion); +destroy_rcu_head_on_stack (&rcu.head); }EXPORT_SYMBOL_GPL (rcu_barrier_sched);
kernel/rcutorture.c +2 -0
@@ -450,9 +450,11 @@ static void rcu_bh_torture_synchronize(v {struct rcu_bh_torture_synchronize rcu; +rcu_head_init_on_stack (&rcu.head);init_completion (&rcu.completion);call_rcu_bh (&rcu.head, rcu_bh_torture_wakeme_after_cb);wait_for_completion (&rcu.completion); +destroy_rcu_head_on_stack (&rcu.head); }static struct rcu_torture_ops rcu_bh_ops = {
kernel/rcutree.c +4 -0
@@ -1449,11 +1449,13 @@ void synchronize_sched(void)if (rcu_blocking_is_gp ())return ; +rcu_head_init_on_stack (&rcu.head);init_completion (&rcu.completion);/* Will wake me after RCU finished. */ call_rcu_sched (&rcu.head, wakeme_after_rcu);/* Wait for it. */ wait_for_completion (&rcu.completion); +destroy_rcu_head_on_stack (&rcu.head); }EXPORT_SYMBOL_GPL (synchronize_sched);
@@ -1473,11 +1475,13 @@ void synchronize_rcu_bh(void)if (rcu_blocking_is_gp ())return ; +rcu_head_init_on_stack (&rcu.head);init_completion (&rcu.completion);/* Will wake me after RCU finished. */ call_rcu_bh (&rcu.head, wakeme_after_rcu);/* Wait for it. */ wait_for_completion (&rcu.completion); +destroy_rcu_head_on_stack (&rcu.head); }EXPORT_SYMBOL_GPL (synchronize_rcu_bh);
mm/backing-dev.c +1 -1
@@ -653,7 +653,7 @@ int bdi_init(struct backing_dev_info *bd bdi->max_ratio =100 ; bdi->max_prop_frac =PROP_FRAC_BASE ;spin_lock_init (&bdi->wb_lock); -INIT_RCU_HEAD (&bdi->rcu_head); +rcu_head_init (&bdi->rcu_head);INIT_LIST_HEAD (&bdi->bdi_list);INIT_LIST_HEAD (&bdi->wb_list);INIT_LIST_HEAD (&bdi->work_list);
mm/slob.c +1 -1
@@ -647,7 +647,7 @@ void kmem_cache_free(struct kmem_cache *if (unlikely (c->flags &SLAB_DESTROY_BY_RCU )) {struct slob_rcu *slob_rcu; slob_rcu = b + (c->size -sizeof (struct slob_rcu )); -INIT_RCU_HEAD (&slob_rcu->head); +rcu_head_init (&slob_rcu->head); slob_rcu->size = c->size;call_rcu (&slob_rcu->head, kmem_rcu_free); }else {
fs/file.c +2 -2
@@ -178,7 +178,7 @@ static struct fdtable * alloc_fdtable(un fdt->open_fds = (fd_set *)data; data += nr /BITS_PER_BYTE ; fdt->close_on_exec = (fd_set *)data; -INIT_RCU_HEAD (&fdt->rcu); +rcu_head_init (&fdt->rcu); fdt->next =NULL ;return fdt;
@@ -312,7 +312,7 @@ struct files_struct *dup_fd(struct files new_fdt->close_on_exec = (fd_set *)&newf->close_on_exec_init; new_fdt->open_fds = (fd_set *)&newf->open_fds_init; new_fdt->fd = &newf->fd_array[0 ]; -INIT_RCU_HEAD (&new_fdt->rcu); +rcu_head_init (&new_fdt->rcu); new_fdt->next =NULL ;spin_lock (&oldf->file_lock);
fs/fs-writeback.c +9 -4
@@ -75,9 +75,13 @@ static inline bool bdi_work_on_stack(str }static inline void bdi_work_init (struct bdi_work *work, -struct wb_writeback_args *args) +struct wb_writeback_args *args, +int on_stack) { -INIT_RCU_HEAD (&work->rcu_head); +if (on_stack) +rcu_head_init_on_stack (&work->rcu_head); +else +rcu_head_init (&work->rcu_head); work->args = *args; work->state =WS_USED ; }
@@ -201,7 +205,7 @@ static void bdi_alloc_queue_work(struct*/ work =kmalloc (sizeof (*work),GFP_ATOMIC );if (work) { -bdi_work_init (work, args); +bdi_work_init (work, args,0 );bdi_queue_work (bdi, work); }else {struct bdi_writeback *wb = &bdi->wb;
@@ -232,11 +236,12 @@ static void bdi_sync_writeback(struct ba };struct bdi_work work; -bdi_work_init (&work, &args); +bdi_work_init (&work, &args,1 ); work.state |=WS_ONSTACK ;bdi_queue_work (bdi, &work);bdi_wait_on_work_clear (&work); +destroy_rcu_head_on_stack (&work.rcu_head); }/**
fs/partitions/check.c +1 -1
@@ -454,7 +454,7 @@ struct hd_struct *add_partition(struct g }/* everything is up and running, commence */ -INIT_RCU_HEAD (&p->rcu_head); +rcu_head_init (&p->rcu_head);rcu_assign_pointer (ptbl->part[partno], p);/* suppress uevent if the disk supresses it */
block/cfq-iosched.c +1 -1
@@ -3730,7 +3730,7 @@ static void *cfq_init_queue(struct reque* second, in order to have larger depth for async operations. */ cfqd->last_delayed_sync = jiffies -HZ ; -INIT_RCU_HEAD (&cfqd->rcu); +rcu_head_init (&cfqd->rcu);return cfqd; }
block/genhd.c +1 -1
@@ -987,7 +987,7 @@ int disk_expand_part_tbl(struct gendiskif (!new_ptbl)return -ENOMEM ; -INIT_RCU_HEAD (&new_ptbl->rcu_head); +rcu_head_init (&new_ptbl->rcu_head); new_ptbl->len = target;for (i =0 ; i < len; i++)
net/netfilter/nfnetlink_queue.c +1 -1
@@ -112,7 +112,7 @@ instance_create(u_int16_t queue_num, int inst->copy_mode =NFQNL_COPY_NONE ;spin_lock_init (&inst->lock);INIT_LIST_HEAD (&inst->queue_list); -INIT_RCU_HEAD (&inst->rcu); +rcu_head_init (&inst->rcu);if (!try_module_get (THIS_MODULE )) { err = -EAGAIN ;
net/core/drop_monitor.c +1 -1
@@ -296,7 +296,7 @@ static int dropmon_net_event(struct noti new_stat->dev = dev; new_stat->last_rx = jiffies; -INIT_RCU_HEAD (&new_stat->rcu); +rcu_head_init (&new_stat->rcu);spin_lock (&trace_state_lock);list_add_rcu (&new_stat->list, &hw_stats_list);spin_unlock (&trace_state_lock);
net/ipv6/sit.c +1 -1
@@ -364,7 +364,7 @@ ipip6_tunnel_add_prl(struct ip_tunnel *t goto out; } -INIT_RCU_HEAD (&p->rcu_head); +rcu_head_init (&p->rcu_head); p->next = t->prl; p->addr = a->addr; p->flags = a->flags;
net/ipv6/xfrm6_tunnel.c +1 -1
@@ -187,7 +187,7 @@ alloc_spi:if (!x6spi) goto out; -INIT_RCU_HEAD (&x6spi->rcu_head); +rcu_head_init (&x6spi->rcu_head);memcpy (&x6spi->addr, saddr,sizeof (x6spi->addr)); x6spi->spi = spi;atomic_set (&x6spi->refcnt,1 );
net/netfilter/nf_conntrack_expect.c +1 -1
@@ -232,7 +232,7 @@ struct nf_conntrack_expect *nf_ct_expect new->master = me;atomic_set (&new->use,1 ); -INIT_RCU_HEAD (&new->rcu); +rcu_head_init (&new->rcu);return new; }EXPORT_SYMBOL_GPL (nf_ct_expect_alloc);
net/netfilter/nf_conntrack_extend.c +1 -1
@@ -59,7 +59,7 @@ nf_ct_ext_create(struct nf_ct_ext **ext,if (!*ext)return NULL ; -INIT_RCU_HEAD (&(*ext)->rcu); +rcu_head_init (&(*ext)->rcu); (*ext)->offset[id] = off; (*ext)->len = len;
net/netlabel/netlabel_domainhash.c +1 -1
@@ -315,7 +315,7 @@ int netlbl_domhsh_add(struct netlbl_dom_ entry_old =netlbl_domhsh_search_def (entry->domain);if (entry_old ==NULL ) { entry->valid =1 ; -INIT_RCU_HEAD (&entry->rcu); +rcu_head_init (&entry->rcu);if (entry->domain !=NULL ) {u32 bkt =netlbl_domhsh_hash (entry->domain);
net/netlabel/netlabel_unlabeled.c +3 -3
@@ -327,7 +327,7 @@ static int netlbl_unlhsh_add_addr4(struc entry->list.addr = addr->s_addr & mask->s_addr; entry->list.mask = mask->s_addr; entry->list.valid =1 ; -INIT_RCU_HEAD (&entry->rcu); +rcu_head_init (&entry->rcu); entry->secid = secid;spin_lock (&netlbl_unlhsh_lock);
@@ -373,7 +373,7 @@ static int netlbl_unlhsh_add_addr6(struc entry->list.addr.s6_addr32[3 ] &= mask->s6_addr32[3 ];ipv6_addr_copy (&entry->list.mask, mask); entry->list.valid =1 ; -INIT_RCU_HEAD (&entry->rcu); +rcu_head_init (&entry->rcu); entry->secid = secid;spin_lock (&netlbl_unlhsh_lock);
@@ -410,7 +410,7 @@ static struct netlbl_unlhsh_iface *netlbINIT_LIST_HEAD (&iface->addr4_list);INIT_LIST_HEAD (&iface->addr6_list); iface->valid =1 ; -INIT_RCU_HEAD (&iface->rcu); +rcu_head_init (&iface->rcu);spin_lock (&netlbl_unlhsh_lock);if (ifindex >0 ) {
net/sctp/bind_addr.c +1 -1
@@ -186,7 +186,7 @@ int sctp_add_bind_addr(struct sctp_bind_ addr->valid =1 ;INIT_LIST_HEAD (&addr->list); -INIT_RCU_HEAD (&addr->rcu); +rcu_head_init (&addr->rcu);/* We always hold a socket lock when calling this function, * and that acts as a writer synchronizing lock.
net/sctp/ipv6.c +1 -1
@@ -381,7 +381,7 @@ static void sctp_v6_copy_addrlist(struct addr->a.v6.sin6_scope_id = dev->ifindex; addr->valid =1 ;INIT_LIST_HEAD (&addr->list); -INIT_RCU_HEAD (&addr->rcu); +rcu_head_init (&addr->rcu);list_add_tail (&addr->list, addrlist); } }
net/sctp/protocol.c +1 -1
@@ -188,7 +188,7 @@ static void sctp_v4_copy_addrlist(struct addr->a.v4.sin_addr.s_addr = ifa->ifa_local; addr->valid =1 ;INIT_LIST_HEAD (&addr->list); -INIT_RCU_HEAD (&addr->rcu); +rcu_head_init (&addr->rcu);list_add_tail (&addr->list, addrlist); } }
Signature · 2 lines
Mathieu Desnoyers OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68