Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b6331ae8 authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

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: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
parent 1a6c9b26
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -348,8 +348,8 @@ extern struct srcu_struct tasks_rcu_exit_srcu;
 */
#define cond_resched_rcu_qs() \
do { \
	if (!cond_resched()) \
		rcu_note_voluntary_context_switch(current); \
	cond_resched(); \
} while (0)

#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP)