Re: [PATCH RFC] mm: Implement balance_dirty_pages() through waiting for flusher thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]