Skip to content

Commit

Permalink
vmstat: use raw_cpu_ops to avoid false positives on preemption checks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed Apr 7, 2014
1 parent 88da03a commit 293b6a4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/linux/vmstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ struct vm_event_state {

DECLARE_PER_CPU(struct vm_event_state, vm_event_states);

/*
* vm counters are allowed to be racy. Use raw_cpu_ops to avoid the
* local_irq_disable overhead.
*/
static inline void __count_vm_event(enum vm_event_item item)
{
__this_cpu_inc(vm_event_states.event[item]);
raw_cpu_inc(vm_event_states.event[item]);
}

static inline void count_vm_event(enum vm_event_item item)
Expand All @@ -39,7 +43,7 @@ static inline void count_vm_event(enum vm_event_item item)

static inline void __count_vm_events(enum vm_event_item item, long delta)
{
__this_cpu_add(vm_event_states.event[item], delta);
raw_cpu_add(vm_event_states.event[item], delta);
}

static inline void count_vm_events(enum vm_event_item item, long delta)
Expand Down

0 comments on commit 293b6a4

Please sign in to comment.