Re: [PATCH] [2.5] asm-generic/atomic.h and changes to arm, parisc, mips, m68k, sh, cris to use it

From: Russell King (rmk@arm.linux.org.uk)
Date: Thu Aug 08 2002 - 18:29:58 EST


On Thu, Aug 08, 2002 at 11:43:15PM +0200, Luca Barbieri wrote:
>...

Please don't do this for ARM.

> -static inline int atomic_dec_and_test(volatile atomic_t *v)
> -{
> - unsigned long flags;
> - int val;
> -
> - local_irq_save(flags);
> - val = v->counter;
> - v->counter = val -= 1;
> - local_irq_restore(flags);
> -
> - return val == 0;
> -}

This C code is carefully optimised to allow the compiler to order things
efficiently.

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html

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



This archive was generated by hypermail 2b29 : Thu Aug 15 2002 - 22:00:18 EST