diff options
author | Li Zefan <lizefan@huawei.com> | 2013-12-17 11:13:39 +0800 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-12-17 08:11:52 -0500 |
commit | c1a71504e9715812a2d15e7c03b5aa147ae70ded (patch) | |
tree | 5b58cb4434889ffe3038f6a87fdb1b7cf85dfe2f /arch/alpha/kernel/err_marvel.c | |
parent | 266ccd505e8acb98717819cef9d91d66c7b237cc (diff) | |
download | blackbird-obmc-linux-c1a71504e9715812a2d15e7c03b5aa147ae70ded.tar.gz blackbird-obmc-linux-c1a71504e9715812a2d15e7c03b5aa147ae70ded.zip |
cgroup: don't recycle cgroup id until all csses' have been destroyed
Hugh reported this bug:
> CONFIG_MEMCG_SWAP is broken in 3.13-rc. Try something like this:
>
> mkdir -p /tmp/tmpfs /tmp/memcg
> mount -t tmpfs -o size=1G tmpfs /tmp/tmpfs
> mount -t cgroup -o memory memcg /tmp/memcg
> mkdir /tmp/memcg/old
> echo 512M >/tmp/memcg/old/memory.limit_in_bytes
> echo $$ >/tmp/memcg/old/tasks
> cp /dev/zero /tmp/tmpfs/zero 2>/dev/null
> echo $$ >/tmp/memcg/tasks
> rmdir /tmp/memcg/old
> sleep 1 # let rmdir work complete
> mkdir /tmp/memcg/new
> umount /tmp/tmpfs
> dmesg | grep WARNING
> rmdir /tmp/memcg/new
> umount /tmp/memcg
>
> Shows lots of WARNING: CPU: 1 PID: 1006 at kernel/res_counter.c:91
> res_counter_uncharge_locked+0x1f/0x2f()
>
> Breakage comes from 34c00c319ce7 ("memcg: convert to use cgroup id").
>
> The lifetime of a cgroup id is different from the lifetime of the
> css id it replaced: memsw's css_get()s do nothing to hold on to the
> old cgroup id, it soon gets recycled to a new cgroup, which then
> mysteriously inherits the old's swap, without any charge for it.
Instead of removing cgroup id right after all the csses have been
offlined, we should do that after csses have been destroyed.
To make sure an invalid css pointer won't be returned after the css
is destroyed, make sure css_from_id() returns NULL in this case.
tj: Updated comment to note planned changes for cgrp->id.
Reported-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Li Zefan <lizefan@huawei.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch/alpha/kernel/err_marvel.c')
0 files changed, 0 insertions, 0 deletions