From: Andrew Morton Cc: Paul E. McKenney Cc: Ingo Molnar Signed-off-by: Andrew Morton --- include/linux/list.h | 4 +++- include/linux/sched.h | 13 +++++-------- kernel/fork.c | 4 ++-- kernel/signal.c | 6 ++---- 4 files changed, 12 insertions(+), 15 deletions(-) diff -puN include/linux/list.h~rcu-signal-handling-tidies include/linux/list.h --- devel/include/linux/list.h~rcu-signal-handling-tidies 2005-11-05 02:23:24.000000000 -0800 +++ devel-akpm/include/linux/list.h 2005-11-05 02:23:24.000000000 -0800 @@ -598,7 +598,9 @@ static inline void hlist_del_init(struct * * The old entry will be replaced with the new entry atomically. */ -static inline void hlist_replace_rcu(struct hlist_node *old, struct hlist_node *new){ +static inline void hlist_replace_rcu(struct hlist_node *old, + struct hlist_node *new) +{ struct hlist_node *next = old->next; new->next = next; diff -puN include/linux/sched.h~rcu-signal-handling-tidies include/linux/sched.h --- devel/include/linux/sched.h~rcu-signal-handling-tidies 2005-11-05 02:23:24.000000000 -0800 +++ devel-akpm/include/linux/sched.h 2005-11-05 02:23:24.000000000 -0800 @@ -368,10 +368,10 @@ struct sighand_struct { struct rcu_head rcu; }; +extern void sighand_free_cb(struct rcu_head *rhp); + static inline void sighand_free(struct sighand_struct *sp) { - extern void sighand_free_cb(struct rcu_head *rhp); - call_rcu(&sp->rcu, sighand_free_cb); } @@ -898,11 +898,9 @@ static inline int get_task_struct_rcu(st do { oldusage = atomic_read(&t->usage); - if (oldusage == 0) { + if (oldusage == 0) return 0; - } - } while (cmpxchg(&t->usage.counter, - oldusage, oldusage + 1) != oldusage); + } while (cmpxchg(&t->usage.counter, oldusage, oldusage+1) != oldusage); return 1; } @@ -910,9 +908,8 @@ extern void __put_task_struct_cb(struct static inline void put_task_struct(struct task_struct *t) { - if (atomic_dec_and_test(&t->usage)) { + if (atomic_dec_and_test(&t->usage)) call_rcu(&t->rcu, __put_task_struct_cb); - } } /* diff -puN kernel/fork.c~rcu-signal-handling-tidies kernel/fork.c --- devel/kernel/fork.c~rcu-signal-handling-tidies 2005-11-05 02:23:24.000000000 -0800 +++ devel-akpm/kernel/fork.c 2005-11-05 02:23:24.000000000 -0800 @@ -754,9 +754,9 @@ EXPORT_SYMBOL(unshare_files); void sighand_free_cb(struct rcu_head *rhp) { - struct sighand_struct *sp = - container_of(rhp, struct sighand_struct, rcu); + struct sighand_struct *sp; + sp = container_of(rhp, struct sighand_struct, rcu); kmem_cache_free(sighand_cachep, sp); } diff -puN kernel/signal.c~rcu-signal-handling-tidies kernel/signal.c --- devel/kernel/signal.c~rcu-signal-handling-tidies 2005-11-05 02:23:24.000000000 -0800 +++ devel-akpm/kernel/signal.c 2005-11-05 02:23:24.000000000 -0800 @@ -1111,9 +1111,8 @@ int group_send_sig_info(int sig, struct retry: ret = check_kill_permission(sig, info, p); if (!ret && sig && (sp = p->sighand)) { - if (!get_task_struct_rcu(p)) { + if (!get_task_struct_rcu(p)) return -ESRCH; - } spin_lock_irqsave(&sp->siglock, flags); if (p->sighand != sp) { spin_unlock_irqrestore(&sp->siglock, flags); @@ -1397,7 +1396,6 @@ send_sigqueue(int sig, struct sigqueue * * * We return -1, when the task is marked exiting, so * posix_timer_event can redirect it to the group leader - * */ rcu_read_lock(); @@ -1465,7 +1463,7 @@ send_group_sigqueue(int sig, struct sigq BUG_ON(!(q->flags & SIGQUEUE_PREALLOC)); - while(!read_trylock(&tasklist_lock)) { + while (!read_trylock(&tasklist_lock)) { if (!p->sighand) return -1; cpu_relax(); _