From: Andrew Morton Cc: "Eric W. Biederman" Cc: Balbir Singh Cc: David Rientjes Cc: Herbert Poetzl Cc: KAMEZAWA Hiroyuki Cc: Kirill Korotaev Cc: Nick Piggin Cc: Paul Menage Cc: Pavel Emelianov Cc: Peter Zijlstra Cc: Vaidyanathan Srinivasan Cc: YAMAMOTO Takashi Signed-off-by: Andrew Morton --- mm/memcontrol.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff -puN mm/memcontrol.c~memory-cgroup-enhancements-add-status-accounting-function-for-memory-cgroup-fix-1 mm/memcontrol.c --- a/mm/memcontrol.c~memory-cgroup-enhancements-add-status-accounting-function-for-memory-cgroup-fix-1 +++ a/mm/memcontrol.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -61,10 +62,10 @@ struct mem_cgroup_stat { static inline void __mem_cgroup_stat_add(struct mem_cgroup_stat *stat, enum mem_cgroup_stat_index idx, int val) { - int cpu = smp_processor_id(); - preempt_disable(); + int cpu = get_cpu(); + stat->cpustat[cpu].count[idx] += val; - preempt_enable(); + put_cpu(); } /* _