diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-10-04 06:43:41 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-11-13 13:35:39 -0500 |
commit | b6331ae8afe4118884c4b6e14a213758d88422b2 (patch) | |
tree | d8e91863e7ddd26f8bc98f066dc8ea0ab24c7501 /include/linux/rcupdate.h | |
parent | 1a6c9b2675460718f819def9a272cca35575eeb7 (diff) |
rcu: Optimize cond_resched_rcu_qs()
The current implementation of cond_resched_rcu_qs() can invoke
rcu_note_voluntary_context_switch() twice in the should_resched()
case, once via the call to __schedule() and once directly. However, as
noted by Joe Lawrence in a patch to the team subsystem, cond_resched()
returns an indication as to whether or not the call to __schedule()
actually happened. This commit therefore changes cond_resched_rcu_qs()
so as to invoke rcu_note_voluntary_context_switch() only when __schedule()
was not called.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'include/linux/rcupdate.h')
-rw-r--r-- | include/linux/rcupdate.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index a033d8b55773..36ea3ba5c516 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -348,8 +348,8 @@ extern struct srcu_struct tasks_rcu_exit_srcu; | |||
348 | */ | 348 | */ |
349 | #define cond_resched_rcu_qs() \ | 349 | #define cond_resched_rcu_qs() \ |
350 | do { \ | 350 | do { \ |
351 | rcu_note_voluntary_context_switch(current); \ | 351 | if (!cond_resched()) \ |
352 | cond_resched(); \ | 352 | rcu_note_voluntary_context_switch(current); \ |
353 | } while (0) | 353 | } while (0) |
354 | 354 | ||
355 | #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) | 355 | #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) |