Re: 2.6.6-rc3-mm1

From: Keith Owens
Date: Fri Apr 30 2004 - 08:34:20 EST


On Fri, 30 Apr 2004 01:46:58 -0700,
Andrew Morton <akpm@xxxxxxxx> wrote:
>ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.6-rc3/2.6.6-rc3-mm1/
>+allow-architectures-to-reenable-interrupts-on-contended-spinlocks.patch
>
> Rework the spinlock code so that architectures can reenable interrupts when
> spinning in spin_lock_irq() or spin_lcok_irqsave(). Only implemented for
> ia64 at this stage.

Only spin_lock_irqsave(), not spin_lock_irq(). The patch needs the old
flags to determine if interrupts were originally enabled, the flags are
not saved for spin_lock_irq().

In theory, spin_lock_irq() should never be called when interrupts are
already disabled, the corresponding spin_unlock_irq() will
unconditionally enable interrupts. So it should be possible for
spin_lock_irq() to pass a constant flags value to
_raw_spin_lock_flags(), stating that interrupts were enabled before
spin_lock_irq(). Two problems with that :-

* The flags value for 'interrupts were enabled' is arch specific.

* I have seen buggy code that does spin_lock_irq() when interrupts
are already disabled. Unconditionally enabling interrupts while
waiting for a contended spin_lock_irq() will perturb that code.

For now, the patch only improves the performance of spin_lock_irqsave().

-
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/