diff options
author | Christoph Lameter <cl@linux-foundation.org> | 2009-10-03 06:48:23 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2009-10-03 06:48:23 -0400 |
commit | 4dac3e98840f11bb2d8d52fd375150c7c1912117 (patch) | |
tree | 64a464cb4df4a5e9683da4eabba0e7b399728023 /include/linux/vmstat.h | |
parent | 0b44f4861f4cc1089424821f078d38441f8b4983 (diff) |
this_cpu: Use this_cpu ops for VM statistics
Using per cpu atomics for the vm statistics reduces their overhead.
And in the case of x86 we are guaranteed that they will never race even
in the lax form used for vm statistics.
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/vmstat.h')
-rw-r--r-- | include/linux/vmstat.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 2d0f222388a8..d85889710f9b 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
@@ -76,24 +76,22 @@ DECLARE_PER_CPU(struct vm_event_state, vm_event_states); | |||
76 | 76 | ||
77 | static inline void __count_vm_event(enum vm_event_item item) | 77 | static inline void __count_vm_event(enum vm_event_item item) |
78 | { | 78 | { |
79 | __get_cpu_var(vm_event_states).event[item]++; | 79 | __this_cpu_inc(per_cpu_var(vm_event_states).event[item]); |
80 | } | 80 | } |
81 | 81 | ||
82 | static inline void count_vm_event(enum vm_event_item item) | 82 | static inline void count_vm_event(enum vm_event_item item) |
83 | { | 83 | { |
84 | get_cpu_var(vm_event_states).event[item]++; | 84 | this_cpu_inc(per_cpu_var(vm_event_states).event[item]); |
85 | put_cpu(); | ||
86 | } | 85 | } |
87 | 86 | ||
88 | static inline void __count_vm_events(enum vm_event_item item, long delta) | 87 | static inline void __count_vm_events(enum vm_event_item item, long delta) |
89 | { | 88 | { |
90 | __get_cpu_var(vm_event_states).event[item] += delta; | 89 | __this_cpu_add(per_cpu_var(vm_event_states).event[item], delta); |
91 | } | 90 | } |
92 | 91 | ||
93 | static inline void count_vm_events(enum vm_event_item item, long delta) | 92 | static inline void count_vm_events(enum vm_event_item item, long delta) |
94 | { | 93 | { |
95 | get_cpu_var(vm_event_states).event[item] += delta; | 94 | this_cpu_add(per_cpu_var(vm_event_states).event[item], delta); |
96 | put_cpu(); | ||
97 | } | 95 | } |
98 | 96 | ||
99 | extern void all_vm_events(unsigned long *); | 97 | extern void all_vm_events(unsigned long *); |