[cpuops inc_return V1 7/9] fs: Use this_cpu_inc_return in buffer.c

From: Christoph Lameter
Date: Mon Dec 06 2010 - 12:40:36 EST


__this_cpu_inc can create a single instruction with the same effect
as the _get_cpu_var(..)++ construct in buffer.c.

Cc: Wu Fengguang <fengguang.wu@xxxxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxx>
Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>

---
fs/buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/fs/buffer.c
===================================================================
--- linux-2.6.orig/fs/buffer.c 2010-12-06 10:56:21.000000000 -0600
+++ linux-2.6/fs/buffer.c 2010-12-06 10:56:26.000000000 -0600
@@ -3201,7 +3201,7 @@ static void recalc_bh_state(void)
int i;
int tot = 0;

- if (__get_cpu_var(bh_accounting).ratelimit++ < 4096)
+ if (__this_cpu_inc_return(bh_accounting.ratelimit) - 1 < 4096)
return;
__this_cpu_write(bh_accounting.ratelimit, 0);
for_each_online_cpu(i)

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