summaryrefslogtreecommitdiff
path: root/mm/vmstat.c
diff options
context:
space:
mode:
authorChristoph Lameter <cl@linux.com>2010-12-06 20:40:02 +0300
committerTejun Heo <tj@kernel.org>2010-12-17 17:18:04 +0300
commit908ee0f122bf2a67414854af5b90c6621d186a71 (patch)
tree5394b0b65dada76fed551d44ca0561fe5b7ac839 /mm/vmstat.c
parent275c8b93288ef0c2281e414e069ea8ed4bad03f7 (diff)
downloadlinux-908ee0f122bf2a67414854af5b90c6621d186a71.tar.xz
vmstat: Use this_cpu_inc_return for vm statistics
this_cpu_inc_return() saves us a memory access there. Code size does not change. V1->V2: - Fixed the location of the __per_cpu pointer attributes - Sparse checked V2->V3: - Move fixes to __percpu attribute usage to earlier patch Reviewed-by: Pekka Enberg <penberg@kernel.org> Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Christoph Lameter <cl@linux.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'mm/vmstat.c')
-rw-r--r--mm/vmstat.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 3ad909d9600f..f9a7bc89fd10 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -227,9 +227,7 @@ void __inc_zone_state(struct zone *zone, enum zone_stat_item item)
s8 __percpu *p = pcp->vm_stat_diff + item;
s8 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)) {
s8 overstep = t >> 1;
@@ -251,9 +249,7 @@ void __dec_zone_state(struct zone *zone, enum zone_stat_item item)
s8 __percpu *p = pcp->vm_stat_diff + item;
s8 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)) {
s8 overstep = t >> 1;