Re: [PATCH] memcg: Fix race condition in memcg_check_events() withthis_cpu usage

From: Greg Thelen
Date: Fri Sep 23 2011 - 22:34:53 EST


On Fri, Sep 23, 2011 at 5:54 PM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> From: Steven Rostedt <srostedt@xxxxxxxxxx>
>
> The code in memcg_check_events() calls this_cpu_read() on
> different variables without disabling preemption, and can cause
> the calculations to be done from two different CPU variables.
>
> Disable preemption throughout the check to keep apples and oranges
> from becoming a mixed drink.
>
> [ Added this_cpu to __this_cpu conversion by Johannes ]
>
> Cc: Greg Thelen <gthelen@xxxxxxxxxx>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
> Cc: Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx>
> Cc: Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Christoph Lameter <cl@xxxxxxxxx>
> Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx>
> Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Link: http://lkml.kernel.org/r/20110919212641.015320989@xxxxxxxxxxx

Looks good to me. Thanks.

Reviewed-by: Greg Thelen <gthelen@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/