History

[PATCH] convert kernel/rcupdate.c:rcu_barrier_sema to mutex

Convert kernel/rcupdate's rcu_barrier_sema to mutex.

Ingo Molnar committed 20 years ago

Commit 9331b311 parent 3d3f26a1 file · +5 −5Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/rcupdate.c+5−5
@@ -47,6 +47,7 @@ · 46 unmodified lines
4747 #include <linux/notifier.h>
4848 #include <linux/rcupdate.h>
4949 #include <linux/cpu.h>
50+#include <linux/mutex.h>
5051
5152 /* Definition for rcupdate control block. */
5253 struct rcu_ctrlblk rcu_ctrlblk = {
@@ -75,7 +76,7 @@ static int rsinterval = 1000; · 22 unmodified lines
7576 #endif
7677
7778 static atomic_t rcu_barrier_cpu_count;
78−static struct semaphore rcu_barrier_sema;
79+static DEFINE_MUTEX(rcu_barrier_mutex);
7980 static struct completion rcu_barrier_completion;
8081
8182 #ifdef CONFIG_SMP
@@ -207,13 +208,13 @@ static void rcu_barrier_func(void *notused) · 125 unmodified lines
207208 void rcu_barrier(void)
208209 {
209210 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);
212213 init_completion(&rcu_barrier_completion);
213214 atomic_set(&rcu_barrier_cpu_count, 0);
214215 on_each_cpu(rcu_barrier_func, NULL, 0, 1);
215216 wait_for_completion(&rcu_barrier_completion);
216− up(&rcu_barrier_sema);
217+ mutex_unlock(&rcu_barrier_mutex);
217218 }
218219 EXPORT_SYMBOL_GPL(rcu_barrier);
219220
@@ -549,7 +550,6 @@ static struct notifier_block __devinitdata rcu_nb = { · 329 unmodified lines
549550 */
550551 void __init rcu_init(void)
551552 {
552− sema_init(&rcu_barrier_sema, 1);
553553 rcu_cpu_notify(&rcu_nb, CPU_UP_PREPARE,
554554 (void *)(long)smp_processor_id());
555555 /* Register notifier for non-boot CPUs */