Re: [PATCH, RFC, tip/core/rcu] v3 scalable classic RCUimplementation
From: Paul E. McKenney
Date: Mon Sep 01 2008 - 21:05:58 EST
On Mon, Sep 01, 2008 at 11:38:29AM +0200, Andi Kleen wrote:
> "Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx> writes:
> >
> > -#if defined(CONFIG_PREEMPT_RCU) && defined(CONFIG_NO_HZ)
> > +#if defined(CONFIG_NO_HZ)
> > extern void rcu_irq_enter(void);
> > extern void rcu_irq_exit(void);
> > #else
> > # define rcu_irq_enter() do { } while (0)
> > # define rcu_irq_exit() do { } while (0)
> > -#endif /* CONFIG_PREEMPT_RCU */
> > +#endif /* #if defined(CONFIG_NO_HZ) */
>
> It would be better if you hung rcu_irq_enter in the irq_enter() if
> statement that checks if the task was idle or not. This way it would
> be zero overhead for interruptions of non busy CPUs, keeping
> it out of many fast paths.
>
> Haven't read everything, sorry.
So that I lose the #else above, and so that irq_enter() and irq_exit()
look something like the following (with additional adjustments to suit)?
Makes a lot of sense to me...
And it has the very nice side effect of allowing me to have a separate
rcu_irq_enter() and rcu_nmi_enter(), trivializing the RCU-dynticks
interface!!! Very cool, thank you very much!!!
Thanx, Paul
void irq_enter(void)
{
#ifdef CONFIG_NO_HZ
int cpu = smp_processor_id();
if (idle_cpu(cpu) && !in_interrupt())
tick_nohz_stop_idle(cpu);
#endif
__irq_enter();
#ifdef CONFIG_NO_HZ
if (idle_cpu(cpu)) {
rcu_irq_enter();
tick_nohz_update_jiffies();
}
#endif
}
void irq_exit(void)
{
account_system_vtime(current);
trace_hardirq_exit();
sub_preempt_count(IRQ_EXIT_OFFSET);
if (!in_interrupt() && local_softirq_pending())
invoke_softirq();
#ifdef CONFIG_NO_HZ
/* Make sure that timer wheel updates are propagated */
if (idle_cpu(smp_processor_id())) {
if (!in_interrupt() && !need_resched())
tick_nohz_stop_sched_tick(0);
rcu_irq_exit();
}
#endif
preempt_enable_no_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/