Re: [RFC PATCH 5/6] implement per-cpu&per-domain state machinecall_srcu()

From: Peter Zijlstra
Date: Tue Mar 06 2012 - 10:31:39 EST


On Tue, 2012-03-06 at 22:44 +0800, Lai Jiangshan wrote:
> >> + if ((++idle_loop & 0xF) == 0) {
> >> + spin_unlock_irq(&sp->gp_lock);
> >> + udelay(1);
> >> + spin_lock_irq(&sp->gp_lock);
> >> + }
> >
> > The purpose of this bit isn't quite clear to me, is this simply a lock
> > break?
>
> Yes, the main purpose is:
> make the time of sp->gp_lock short, can be determined.

either introduce cond_resched_lock_irq() or write something like:

if (need_resched() || spin_needbreak(&sp->gp_lock)) {
spin_unlock_irq(&sp->gp_lock);
cond_resched();
spin_lock_irq(&sp->gp_lock);
}

udelay(1) is complete nonsense..
--
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/