Skip to content

Commit

Permalink
rcu: Avoid unnecessary self-wakeup of per-CPU kthreads
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
  • Loading branch information
Shaohua Li authored and paulmck committed Sep 29, 2011
1 parent 1f28809 commit 1eb5212
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions kernel/rcutree_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -1291,11 +1291,9 @@ static void invoke_rcu_callbacks_kthread(void)

local_irq_save(flags);
__this_cpu_write(rcu_cpu_has_work, 1);
if (__this_cpu_read(rcu_cpu_kthread_task) == NULL) {
local_irq_restore(flags);
return;
}
wake_up_process(__this_cpu_read(rcu_cpu_kthread_task));
if (__this_cpu_read(rcu_cpu_kthread_task) != NULL &&
current != __this_cpu_read(rcu_cpu_kthread_task))
wake_up_process(__this_cpu_read(rcu_cpu_kthread_task));
local_irq_restore(flags);
}

Expand Down

0 comments on commit 1eb5212

Please sign in to comment.