Commit 908ee0f122bf2a67414854af5b90c6621d186a71

Authored by Christoph Lameter
Committed by Tejun Heo
1 parent 275c8b9328

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>

Showing 1 changed file with 2 additions and 6 deletions Side-by-side Diff

... ... @@ -227,9 +227,7 @@
227 227 s8 __percpu *p = pcp->vm_stat_diff + item;
228 228 s8 v, t;
229 229  
230   - __this_cpu_inc(*p);
231   -
232   - v = __this_cpu_read(*p);
  230 + v = __this_cpu_inc_return(*p);
233 231 t = __this_cpu_read(pcp->stat_threshold);
234 232 if (unlikely(v > t)) {
235 233 s8 overstep = t >> 1;
... ... @@ -251,9 +249,7 @@
251 249 s8 __percpu *p = pcp->vm_stat_diff + item;
252 250 s8 v, t;
253 251  
254   - __this_cpu_dec(*p);
255   -
256   - v = __this_cpu_read(*p);
  252 + v = __this_cpu_dec_return(*p);
257 253 t = __this_cpu_read(pcp->stat_threshold);
258 254 if (unlikely(v < - t)) {
259 255 s8 overstep = t >> 1;