]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
radix-tree: account nodes to memcg only if explicitly requested
authorVladimir Davydov <vdavydov@virtuozzo.com>
Tue, 2 Aug 2016 21:03:01 +0000 (14:03 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Aug 2016 07:34:59 +0000 (09:34 +0200)
commit061783ef7814be4b2d625d763910a4b77a77cb11
tree6822869a9de937e52b1e265682584ab4cf102147
parent4a226bf30f44fd5cb4781666df73e228d37a46d8
radix-tree: account nodes to memcg only if explicitly requested

commit 05eb6e7263185a6bb0de9501ccf2addc52429414 upstream.

Radix trees may be used not only for storing page cache pages, so
unconditionally accounting radix tree nodes to the current memory cgroup
is bad: if a radix tree node is used for storing data shared among
different cgroups we risk pinning dead memory cgroups forever.

So let's only account radix tree nodes if it was explicitly requested by
passing __GFP_ACCOUNT to INIT_RADIX_TREE.  Currently, we only want to
account page cache entries, so mark mapping->page_tree so.

Fixes: 58e698af4c63 ("radix-tree: account radix_tree_node to memory cgroup")
Link: http://lkml.kernel.org/r/1470057188-7864-1-git-send-email-vdavydov@virtuozzo.com
Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/inode.c
lib/radix-tree.c