rcu: performance fixes to TINY_PREEMPT_RCU callback checking

This commit tightens up checks in rcu_preempt_check_callbacks() to avoid
unnecessary special handling at rcu_read_unlock() time.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
This commit is contained in:
Paul E. McKenney 2010-08-27 10:51:17 -07:00
parent 2c96c7751d
commit dd7c4d8973

View File

@ -72,7 +72,7 @@ static void rcu_report_exp_done(void);
/* /*
* Return true if the CPU has not yet responded to the current grace period. * Return true if the CPU has not yet responded to the current grace period.
*/ */
static int rcu_cpu_cur_gp(void) static int rcu_cpu_blocking_cur_gp(void)
{ {
return rcu_preempt_ctrlblk.gpcpu != rcu_preempt_ctrlblk.gpnum; return rcu_preempt_ctrlblk.gpcpu != rcu_preempt_ctrlblk.gpnum;
} }
@ -229,7 +229,7 @@ void rcu_preempt_note_context_switch(void)
* cannot end. * cannot end.
*/ */
list_add(&t->rcu_node_entry, &rcu_preempt_ctrlblk.blkd_tasks); list_add(&t->rcu_node_entry, &rcu_preempt_ctrlblk.blkd_tasks);
if (rcu_cpu_cur_gp()) if (rcu_cpu_blocking_cur_gp())
rcu_preempt_ctrlblk.gp_tasks = &t->rcu_node_entry; rcu_preempt_ctrlblk.gp_tasks = &t->rcu_node_entry;
} }
@ -368,12 +368,16 @@ static void rcu_preempt_check_callbacks(void)
{ {
struct task_struct *t = current; struct task_struct *t = current;
if (!rcu_preempt_running_reader() && rcu_preempt_gp_in_progress()) if (rcu_preempt_gp_in_progress() &&
(!rcu_preempt_running_reader() ||
!rcu_cpu_blocking_cur_gp()))
rcu_preempt_cpu_qs(); rcu_preempt_cpu_qs();
if (&rcu_preempt_ctrlblk.rcb.rcucblist != if (&rcu_preempt_ctrlblk.rcb.rcucblist !=
rcu_preempt_ctrlblk.rcb.donetail) rcu_preempt_ctrlblk.rcb.donetail)
raise_softirq(RCU_SOFTIRQ); raise_softirq(RCU_SOFTIRQ);
if (rcu_preempt_gp_in_progress() && rcu_preempt_running_reader()) if (rcu_preempt_gp_in_progress() &&
rcu_cpu_blocking_cur_gp() &&
rcu_preempt_running_reader())
t->rcu_read_unlock_special |= RCU_READ_UNLOCK_NEED_QS; t->rcu_read_unlock_special |= RCU_READ_UNLOCK_NEED_QS;
} }