diff options
| author | Christoph Lameter <cl@linux.com> | 2014-04-07 18:39:43 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-07 19:36:14 -0400 |
| commit | 293b6a4c875c3b49853bff7de99954f49f59aa75 (patch) | |
| tree | c05e009383b80e79f477a8d4aa6f779bab04f668 /include/linux | |
| parent | 88da03a67674bcd6e9ecf18a0a182cf1303056ba (diff) | |
vmstat: use raw_cpu_ops to avoid false positives on preemption checks
vm counters are allowed to be racy. Use raw_cpu_ops to avoid the
local_irq_disable overhead and to avoid preemption checks which will be
added to the __this_cpu operations.
[akpm@linux-foundation.org: Add comment. Again.]
Signed-off-by: Christoph Lameter <cl@linux.com>
Reported-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/vmstat.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index ea4476157e00..45c9cd1daf7a 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
| @@ -27,9 +27,13 @@ struct vm_event_state { | |||
| 27 | 27 | ||
| 28 | DECLARE_PER_CPU(struct vm_event_state, vm_event_states); | 28 | DECLARE_PER_CPU(struct vm_event_state, vm_event_states); |
| 29 | 29 | ||
| 30 | /* | ||
| 31 | * vm counters are allowed to be racy. Use raw_cpu_ops to avoid the | ||
| 32 | * local_irq_disable overhead. | ||
| 33 | */ | ||
| 30 | static inline void __count_vm_event(enum vm_event_item item) | 34 | static inline void __count_vm_event(enum vm_event_item item) |
| 31 | { | 35 | { |
| 32 | __this_cpu_inc(vm_event_states.event[item]); | 36 | raw_cpu_inc(vm_event_states.event[item]); |
| 33 | } | 37 | } |
| 34 | 38 | ||
| 35 | static inline void count_vm_event(enum vm_event_item item) | 39 | static inline void count_vm_event(enum vm_event_item item) |
| @@ -39,7 +43,7 @@ static inline void count_vm_event(enum vm_event_item item) | |||
| 39 | 43 | ||
| 40 | static inline void __count_vm_events(enum vm_event_item item, long delta) | 44 | static inline void __count_vm_events(enum vm_event_item item, long delta) |
| 41 | { | 45 | { |
| 42 | __this_cpu_add(vm_event_states.event[item], delta); | 46 | raw_cpu_add(vm_event_states.event[item], delta); |
| 43 | } | 47 | } |
| 44 | 48 | ||
| 45 | static inline void count_vm_events(enum vm_event_item item, long delta) | 49 | static inline void count_vm_events(enum vm_event_item item, long delta) |
