On Tue, 2010-06-22 at 21:52 +0800, Wu Fengguang wrote: > #include <stdio.h> > > typedef struct { > int counter; > } atomic_t; > > static inline int atomic_dec_and_test(atomic_t *v) > { > unsigned char c; > > asm volatile("lock; decl %0; sete %1" > : "+m" (v->counter), "=qm" (c) > : : "memory"); > return c != 0; > } > > int main(void) > { > atomic_t i; > > i.counter = 100000000; > > for (; !atomic_dec_and_test(&i);) > ; > > return 0; > } This test utterly fails to stress the concurrency, you want to create nr_cpus threads and then pound the global variable. Then compare it against the per-cpu-counter variant. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html