rcu: fix rcutree grace-period-latency bug on small systems
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 5 Jan 2009 04:30:06 +0000 (20:30 -0800)
committerIngo Molnar <mingo@elte.hu>
Mon, 5 Jan 2009 09:10:28 +0000 (10:10 +0100)
Impact: fix delays during bootup

Kudos to Andi Kleen for finding a grace-period-latency problem!  The
problem was that the special-case code for small machines never updated
the ->signaled field to indicate that grace-period initialization had
completed, which prevented force_quiescent_state() from ever expediting
grace periods.  This problem resulted in grace periods extending for more
than 20 seconds.  Not subtle.  I introduced this bug during my inspection
process when I fixed a race between grace-period initialization and
force_quiescent_state() execution.

The following patch properly updates the ->signaled field for the
"small"-system case (no more than 32 CPUs for 32-bit kernels and no more
than 64 CPUs for 64-bit kernels).

Reported-by: Andi Kleen <andi@firstfloor.org>
Tested-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/rcutree.c

index a342b03..88d921c 100644 (file)
@@ -572,6 +572,7 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags)
        /* Special-case the common single-level case. */
        if (NUM_RCU_NODES == 1) {
                rnp->qsmask = rnp->qsmaskinit;
+               rsp->signaled = RCU_SIGNAL_INIT; /* force_quiescent_state OK. */
                spin_unlock_irqrestore(&rnp->lock, flags);
                return;
        }