summaryrefslogtreecommitdiff
path: root/mm/quicklist.c
diff options
context:
space:
mode:
authorVladimir Davydov <vdavydov@parallels.com>2014-01-24 03:53:09 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-24 04:36:51 +0400
commitd6441637709ba302905f1076f2afcb6d4ea3a901 (patch)
tree043dab40e692dc25d92d40c19218e0386336d274 /mm/quicklist.c
parent6de64beb3435ab8f2ac1428dd7dddad5dc679c4b (diff)
downloadlinux-d6441637709ba302905f1076f2afcb6d4ea3a901.tar.xz
memcg: rework memcg_update_kmem_limit synchronization
Currently we take both the memcg_create_mutex and the set_limit_mutex when we enable kmem accounting for a memory cgroup, which makes kmem activation events serialize with both memcg creations and other memcg limit updates (memory.limit, memory.memsw.limit). However, there is no point in such strict synchronization rules there. First, the set_limit_mutex was introduced to keep the memory.limit and memory.memsw.limit values in sync. Since memory.kmem.limit can be set independently of them, it is better to introduce a separate mutex to synchronize against concurrent kmem limit updates. Second, we take the memcg_create_mutex in order to make sure all children of this memcg will be kmem-active as well. For achieving that, it is enough to hold this mutex only while checking if memcg_has_children() though. This guarantees that if a child is added after we checked that the memcg has no children, the newly added cgroup will see its parent kmem-active (of course if the latter succeeded), and call kmem activation for itself. This patch simplifies the locking rules of memcg_update_kmem_limit() according to these considerations. [vdavydov@parallels.com: fix unintialized var warning] Signed-off-by: Vladimir Davydov <vdavydov@parallels.com> Cc: Michal Hocko <mhocko@suse.cz> Cc: Glauber Costa <glommer@gmail.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Balbir Singh <bsingharora@gmail.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/quicklist.c')
0 files changed, 0 insertions, 0 deletions