Commit f2e4bd2b authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'core-fixes-for-linus' of...

Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  rcupdate: fix bug of rcu_barrier*()
  profiling: fix !procfs build

Fixed trivial conflicts in 'include/linux/profile.h'
parents 133e887f 5f865151
...@@ -119,18 +119,19 @@ static void _rcu_barrier(enum rcu_barrier type) ...@@ -119,18 +119,19 @@ static void _rcu_barrier(enum rcu_barrier type)
/* Take cpucontrol mutex to protect against CPU hotplug */ /* Take cpucontrol mutex to protect against CPU hotplug */
mutex_lock(&rcu_barrier_mutex); mutex_lock(&rcu_barrier_mutex);
init_completion(&rcu_barrier_completion); init_completion(&rcu_barrier_completion);
atomic_set(&rcu_barrier_cpu_count, 0);
/* /*
* The queueing of callbacks in all CPUs must be atomic with * Initialize rcu_barrier_cpu_count to 1, then invoke
* respect to RCU, otherwise one CPU may queue a callback, * rcu_barrier_func() on each CPU, so that each CPU also has
* wait for a grace period, decrement barrier count and call * incremented rcu_barrier_cpu_count. Only then is it safe to
* complete(), while other CPUs have not yet queued anything. * decrement rcu_barrier_cpu_count -- otherwise the first CPU
* So, we need to make sure that grace periods cannot complete * might complete its grace period before all of the other CPUs
* until all the callbacks are queued. * did their increment, causing this function to return too
* early.
*/ */
rcu_read_lock(); atomic_set(&rcu_barrier_cpu_count, 1);
on_each_cpu(rcu_barrier_func, (void *)type, 1); on_each_cpu(rcu_barrier_func, (void *)type, 1);
rcu_read_unlock(); if (atomic_dec_and_test(&rcu_barrier_cpu_count))
complete(&rcu_barrier_completion);
wait_for_completion(&rcu_barrier_completion); wait_for_completion(&rcu_barrier_completion);
mutex_unlock(&rcu_barrier_mutex); mutex_unlock(&rcu_barrier_mutex);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment