diff options
author | Shaohua Li <shaohua.li@intel.com> | 2011-06-16 19:02:54 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-09-29 00:36:34 -0400 |
commit | 1eb521210a8c9823038abe4ddfe8c69e713ec17d (patch) | |
tree | f9fc70df7c25f80def12aeb231475405043eb1ed /kernel/rcutree_plugin.h | |
parent | 1f288094807861ec1e48c428d2c49ccf7aaf3767 (diff) |
rcu: Avoid unnecessary self-wakeup of per-CPU kthreads
There are a number of cases where the RCU can find additional work
for the per-CPU kthread within the context of that per-CPU kthread.
In such cases, the per-CPU kthread is already running, so attempting
to wake itself up does nothing except waste CPU cycles. This commit
therefore checks to see if it is in the per-CPU kthread context,
omitting the wakeup in this case.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcutree_plugin.h')
-rw-r--r-- | kernel/rcutree_plugin.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h index 7b850cdc0aee..970329853dc5 100644 --- a/kernel/rcutree_plugin.h +++ b/kernel/rcutree_plugin.h | |||
@@ -1291,11 +1291,9 @@ static void invoke_rcu_callbacks_kthread(void) | |||
1291 | 1291 | ||
1292 | local_irq_save(flags); | 1292 | local_irq_save(flags); |
1293 | __this_cpu_write(rcu_cpu_has_work, 1); | 1293 | __this_cpu_write(rcu_cpu_has_work, 1); |
1294 | if (__this_cpu_read(rcu_cpu_kthread_task) == NULL) { | 1294 | if (__this_cpu_read(rcu_cpu_kthread_task) != NULL && |
1295 | local_irq_restore(flags); | 1295 | current != __this_cpu_read(rcu_cpu_kthread_task)) |
1296 | return; | 1296 | wake_up_process(__this_cpu_read(rcu_cpu_kthread_task)); |
1297 | } | ||
1298 | wake_up_process(__this_cpu_read(rcu_cpu_kthread_task)); | ||
1299 | local_irq_restore(flags); | 1297 | local_irq_restore(flags); |
1300 | } | 1298 | } |
1301 | 1299 | ||