Commit 9331b3157c835353dd28efcd80d23563ad226aee
Committed by
Linus Torvalds
1 parent
3d3f26a7ba
Exists in
master
and in
4 other branches
[PATCH] convert kernel/rcupdate.c:rcu_barrier_sema to mutex
Convert kernel/rcupdate's rcu_barrier_sema to mutex. Signed-off-by: Ingo Molnar <mingo@elte.hu> Acked-by: "Paul E. McKenney" <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 1 changed file with 5 additions and 5 deletions Side-by-side Diff
kernel/rcupdate.c
... | ... | @@ -47,6 +47,7 @@ |
47 | 47 | #include <linux/notifier.h> |
48 | 48 | #include <linux/rcupdate.h> |
49 | 49 | #include <linux/cpu.h> |
50 | +#include <linux/mutex.h> | |
50 | 51 | |
51 | 52 | /* Definition for rcupdate control block. */ |
52 | 53 | struct rcu_ctrlblk rcu_ctrlblk = { |
... | ... | @@ -75,7 +76,7 @@ |
75 | 76 | #endif |
76 | 77 | |
77 | 78 | static atomic_t rcu_barrier_cpu_count; |
78 | -static struct semaphore rcu_barrier_sema; | |
79 | +static DEFINE_MUTEX(rcu_barrier_mutex); | |
79 | 80 | static struct completion rcu_barrier_completion; |
80 | 81 | |
81 | 82 | #ifdef CONFIG_SMP |
82 | 83 | |
... | ... | @@ -207,13 +208,13 @@ |
207 | 208 | void rcu_barrier(void) |
208 | 209 | { |
209 | 210 | BUG_ON(in_interrupt()); |
210 | - /* Take cpucontrol semaphore to protect against CPU hotplug */ | |
211 | - down(&rcu_barrier_sema); | |
211 | + /* Take cpucontrol mutex to protect against CPU hotplug */ | |
212 | + mutex_lock(&rcu_barrier_mutex); | |
212 | 213 | init_completion(&rcu_barrier_completion); |
213 | 214 | atomic_set(&rcu_barrier_cpu_count, 0); |
214 | 215 | on_each_cpu(rcu_barrier_func, NULL, 0, 1); |
215 | 216 | wait_for_completion(&rcu_barrier_completion); |
216 | - up(&rcu_barrier_sema); | |
217 | + mutex_unlock(&rcu_barrier_mutex); | |
217 | 218 | } |
218 | 219 | EXPORT_SYMBOL_GPL(rcu_barrier); |
219 | 220 | |
... | ... | @@ -549,7 +550,6 @@ |
549 | 550 | */ |
550 | 551 | void __init rcu_init(void) |
551 | 552 | { |
552 | - sema_init(&rcu_barrier_sema, 1); | |
553 | 553 | rcu_cpu_notify(&rcu_nb, CPU_UP_PREPARE, |
554 | 554 | (void *)(long)smp_processor_id()); |
555 | 555 | /* Register notifier for non-boot CPUs */ |