]> git.karo-electronics.de Git - karo-tx-linux.git/commit
memcg: Fix race condition in memcg_check_events() with this_cpu usage
authorSteven Rostedt <srostedt@redhat.com>
Wed, 28 Sep 2011 00:50:57 +0000 (10:50 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 30 Sep 2011 04:53:45 +0000 (14:53 +1000)
commitdb5379a7b5a0e9e9b0bfad517fc6fc9648d60585
tree9bf3913aa702bd9a179669dbd1d8efc72f90c6b5
parent5de0e6a7735dc192c9dc911f1bb1cb080f07459f
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.

[ Added this_cpu to __this_cpu conversion by Johannes ]

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Greg Thelen <gthelen@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Lameter <cl@linux.com>
Signed-off-by: Andrew Morton <>
mm/memcontrol.c