memcg: Fix race condition in memcg_check_events() with this_cpu usage
authorSteven Rostedt <[email protected]>
Wed, 2 Nov 2011 20:38:33 +0000 (13:38 -0700)
committerLinus Torvalds <[email protected]>
Wed, 2 Nov 2011 23:07:00 +0000 (16:07 -0700)
commit4799401fef9d5951b2da384c5eb08034c48e08a0
tree94f9113c6870f46811aaa0f08cdb3ca2beba1e9c
parenta61ed3cec51cfd4877855c24890ab8d3e2b143e3
memcg: Fix race condition in memcg_check_events() with this_cpu usage

Various code in memcontrol.c () calls this_cpu_read() on the calculations
to be done from two different percpu variables, or does an open-coded
read-modify-write on a single percpu variable.

Disable preemption throughout these operations so that the writes go to
the correct palces.

[[email protected]: added this_cpu to __this_cpu conversion]
Signed-off-by: Johannes Weiner <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
Cc: Greg Thelen <[email protected]>
Cc: KAMEZAWA Hiroyuki <[email protected]>
Cc: Balbir Singh <[email protected]>
Cc: Daisuke Nishimura <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Christoph Lameter <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/memcontrol.c