Re: [PATCH RFC] mm: Implement balance_dirty_pages() through waiting for flusher thread
From: Peter Zijlstra <peterz@infradead.org>
Date: 2010-06-22 14:00:54
Also in:
linux-fsdevel
From: Peter Zijlstra <peterz@infradead.org>
Date: 2010-06-22 14:00:54
Also in:
linux-fsdevel
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@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>