[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160803123445.GJ13263@esperanza>
Date: Wed, 3 Aug 2016 15:34:45 +0300
From: Vladimir Davydov <vdavydov@...tuozzo.com>
To: Andrew Morton <akpm@...ux-foundation.org>
CC: <stable@...r.kernel.org>, Johannes Weiner <hannes@...xchg.org>,
"Michal Hocko" <mhocko@...nel.org>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 1/3] mm: memcontrol: fix swap counter leak on swapout
from offline cgroup
On Wed, Aug 03, 2016 at 01:35:06PM +0300, Vladimir Davydov wrote:
> An offline memory cgroup might have anonymous memory or shmem left
> charged to it and no swap. Since only swap entries pin the id of an
> offline cgroup, such a cgroup will have no id and so an attempt to
> swapout its anon/shmem will not store memory cgroup info in the swap
> cgroup map. As a result, memcg->swap or memcg->memsw will never get
> uncharged from it and any of its ascendants.
>
> Fix this by always charging swapout to the first ancestor cgroup that
> hasn't released its id yet.
>
> [hannes@...xchg.org: add comment to mem_cgroup_swapout]
> Fixes: 73f576c04b941 ("mm: memcontrol: fix cgroup creation failure after many small jobs")
> Signed-off-by: Vladimir Davydov <vdavydov@...tuozzo.com>
> Acked-by: Johannes Weiner <hannes@...xchg.org>
> Acked-by: Michal Hocko <mhocko@...e.com>
> Cc: <stable@...r.kernel.org> [3.19+]
Andrew, could you please fold this in?
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1c0aa59fd333..8c8e68becee9 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4044,7 +4044,7 @@ static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)
* The root cgroup cannot be destroyed, so it's refcount must
* always be >= 1.
*/
- if (memcg == root_mem_cgroup) {
+ if (WARN_ON_ONCE(memcg == root_mem_cgroup)) {
VM_BUG_ON(1);
break;
}
Powered by blists - more mailing lists