Re: [PATCH] 2.4.18 raid1 - fix SMP locking/interrupt errors, fix resync

Andrew Morton (akpm@zip.com.au)
Sun, 24 Mar 2002 15:24:05 -0800


Neil Brown wrote:
>
> ...
> The save/restore versions are only needed if the code might be called
> from interrupt context.

Or if the caller may wish to keep interrupts disabled.

> However the routines where you made this
> change: raid1_grow_buffers, raid1_shrink_buffers, close_sync,
> are only ever called from process context, with interrupts enabled.
> Or am I missing something?

If those functions are always called with interrupts enabled then
no, you're not missing anything ;)

However a bare spin_unlock_irq() in a function means that
callers which wish to keep interrupts disabled are subtly
subverted. We've had bugs from this before.

So the irqrestore functions are much more robust. I believe
that they should be the default choice. The non-restore
versions should be viewed as a micro-optimised version,
to be used with caution. The additional expense of the save/restore
is quite tiny - 20-30 cycles, perhaps.

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