[thiscpuops upgrade 06/10] vmstat: Use this_cpu_inc_return for vm statistics

From: Christoph Lameter
Date: Tue Nov 23 2010 - 18:52:11 EST


this_cpu_inc_return() saves us a memory access there. Code
size does not change.

Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>

---
mm/vmstat.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

Index: linux-2.6/mm/vmstat.c
===================================================================
--- linux-2.6.orig/mm/vmstat.c 2010-11-23 16:35:19.000000000 -0600
+++ linux-2.6/mm/vmstat.c 2010-11-23 16:45:24.000000000 -0600
@@ -227,9 +227,7 @@ void __inc_zone_state(struct zone *zone,
s8 * __percpu p = pcp->vm_stat_diff + item;
int v, t;

- __this_cpu_inc(*p);
-
- v = __this_cpu_read(*p);
+ v = __this_cpu_inc_return(*p);
t = __this_cpu_read(pcp->stat_threshold);
if (unlikely(v > t)) {
int overstep = t / 2;
@@ -251,9 +249,7 @@ void __dec_zone_state(struct zone *zone,
s8 * __percpu p = pcp->vm_stat_diff + item;
int v, t;

- __this_cpu_dec(*p);
-
- v = __this_cpu_read(*p);
+ v = __this_cpu_dec_return(*p);
t = __this_cpu_read(pcp->stat_threshold);
if (unlikely(v < - t)) {
int overstep = t / 2;

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