Re: [GIT PULL rcu/next] rcu commits for 2.6.40

From: Paul E. McKenney
Date: Fri May 13 2011 - 10:15:15 EST


On Fri, May 13, 2011 at 03:12:18PM +0200, Ingo Molnar wrote:
>
> * Ingo Molnar <mingo@xxxxxxx> wrote:
>
> > I started bisecting this, and the two relevant endpoints:
> >
> > bad: 11c476f: net,rcu: convert call_rcu(prl_entry_destroy_rcu) to kfree
> > good: 0ee5623f: Linux 2.6.39-rc6
> >
> > very clearly indicate that this is an RCU regression.
>
> This might be the same one Yinghai found:
>
> e59fb3120bec: rcu: Decrease memory-barrier usage based on semi-formal proof
>
> So with the config i sent it's definitely reproducible.
>
> At first sight couldnt this be related not to barriers, but to not setting
> need_resched() like we did before?

Thank you both!!! I had inspected the commit, but missed the fact that
the new version refuses to call set_need_resched() if irqs are enabled. :-(
The following (untested) patch restores the set_need_resched() operation.

Does this help?

Thanx, Paul

------------------------------------------------------------------------

rcu: Reschedule from dyntick even if irqs are enabled.

Commit e59fb3120bec (rcu: Decrease memory-barrier usage based on
semi-formal proof) attempted to optimize by invoking set_need_resched()
only when irqs are disabled. This patch restores the prior behavior
of invoking set_need_resched() even if irqs are enabled, but leaves
the memory-barrier-usage changes untouched.

Reported-by: Yinghai Lu <yinghai@xxxxxxxxxx>
Reported-by: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 5b0b482..8c490ef 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -335,10 +335,9 @@ void rcu_enter_nohz(void)
local_irq_restore(flags);

/* If the interrupt queued a callback, get out of dyntick mode. */
- if (in_irq() &&
- (__get_cpu_var(rcu_sched_data).nxtlist ||
- __get_cpu_var(rcu_bh_data).nxtlist ||
- rcu_preempt_needs_cpu(smp_processor_id())))
+ if (__get_cpu_var(rcu_sched_data).nxtlist ||
+ __get_cpu_var(rcu_bh_data).nxtlist ||
+ rcu_preempt_needs_cpu(smp_processor_id()))
set_need_resched();
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/