From 7bbcce0ab8c9ef93e1b9627172777f61be46713f Mon Sep 17 00:00:00 2001 From: Sha Zhengju Date: Thu, 10 May 2012 13:01:45 -0700 Subject: [PATCH] --- yaml --- r: 300155 b: refs/heads/master c: 8c7577637ca31385e92769a77e2ab5b428e8b99c h: refs/heads/master i: 300153: 81a4450d8fd707eb8f99f658a08f9a850469091e 300151: 3bbbe6801a5eea5a28db314b0f7f0f99a93255bd v: v3 --- [refs] | 2 +- trunk/mm/memcontrol.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 4614d46ee3d4..a46aae3fb352 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5e2bf0142231194d36fdc9596b36a261ed2b9fe7 +refs/heads/master: 8c7577637ca31385e92769a77e2ab5b428e8b99c diff --git a/trunk/mm/memcontrol.c b/trunk/mm/memcontrol.c index 31ab9c3f0178..b659260c56ad 100644 --- a/trunk/mm/memcontrol.c +++ b/trunk/mm/memcontrol.c @@ -4507,6 +4507,12 @@ static void mem_cgroup_usage_unregister_event(struct cgroup *cgrp, swap_buffers: /* Swap primary and spare array */ thresholds->spare = thresholds->primary; + /* If all events are unregistered, free the spare array */ + if (!new) { + kfree(thresholds->spare); + thresholds->spare = NULL; + } + rcu_assign_pointer(thresholds->primary, new); /* To be sure that nobody uses thresholds */