diff options
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 7caff36180cd..67dd2a881433 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1688,13 +1688,13 @@ static void move_unlock_mem_cgroup(struct mem_cgroup *memcg, | |||
1688 | */ | 1688 | */ |
1689 | void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | 1689 | void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) |
1690 | { | 1690 | { |
1691 | struct cgroup *task_cgrp; | ||
1692 | struct cgroup *mem_cgrp; | ||
1693 | /* | 1691 | /* |
1694 | * Need a buffer in BSS, can't rely on allocations. The code relies | 1692 | * protects memcg_name and makes sure that parallel ooms do not |
1695 | * on the assumption that OOM is serialized for memory controller. | 1693 | * interleave |
1696 | * If this assumption is broken, revisit this code. | ||
1697 | */ | 1694 | */ |
1695 | static DEFINE_SPINLOCK(oom_info_lock); | ||
1696 | struct cgroup *task_cgrp; | ||
1697 | struct cgroup *mem_cgrp; | ||
1698 | static char memcg_name[PATH_MAX]; | 1698 | static char memcg_name[PATH_MAX]; |
1699 | int ret; | 1699 | int ret; |
1700 | struct mem_cgroup *iter; | 1700 | struct mem_cgroup *iter; |
@@ -1703,6 +1703,7 @@ void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
1703 | if (!p) | 1703 | if (!p) |
1704 | return; | 1704 | return; |
1705 | 1705 | ||
1706 | spin_lock(&oom_info_lock); | ||
1706 | rcu_read_lock(); | 1707 | rcu_read_lock(); |
1707 | 1708 | ||
1708 | mem_cgrp = memcg->css.cgroup; | 1709 | mem_cgrp = memcg->css.cgroup; |
@@ -1771,6 +1772,7 @@ done: | |||
1771 | 1772 | ||
1772 | pr_cont("\n"); | 1773 | pr_cont("\n"); |
1773 | } | 1774 | } |
1775 | spin_unlock(&oom_info_lock); | ||
1774 | } | 1776 | } |
1775 | 1777 | ||
1776 | /* | 1778 | /* |
@@ -3000,7 +3002,8 @@ static DEFINE_MUTEX(set_limit_mutex); | |||
3000 | static inline bool memcg_can_account_kmem(struct mem_cgroup *memcg) | 3002 | static inline bool memcg_can_account_kmem(struct mem_cgroup *memcg) |
3001 | { | 3003 | { |
3002 | return !mem_cgroup_disabled() && !mem_cgroup_is_root(memcg) && | 3004 | return !mem_cgroup_disabled() && !mem_cgroup_is_root(memcg) && |
3003 | (memcg->kmem_account_flags & KMEM_ACCOUNTED_MASK); | 3005 | (memcg->kmem_account_flags & KMEM_ACCOUNTED_MASK) == |
3006 | KMEM_ACCOUNTED_MASK; | ||
3004 | } | 3007 | } |
3005 | 3008 | ||
3006 | /* | 3009 | /* |
@@ -3126,7 +3129,7 @@ int memcg_cache_id(struct mem_cgroup *memcg) | |||
3126 | * But when we create a new cache, we can call this as well if its parent | 3129 | * But when we create a new cache, we can call this as well if its parent |
3127 | * is kmem-limited. That will have to hold set_limit_mutex as well. | 3130 | * is kmem-limited. That will have to hold set_limit_mutex as well. |
3128 | */ | 3131 | */ |
3129 | int memcg_update_cache_sizes(struct mem_cgroup *memcg) | 3132 | static int memcg_update_cache_sizes(struct mem_cgroup *memcg) |
3130 | { | 3133 | { |
3131 | int num, ret; | 3134 | int num, ret; |
3132 | 3135 | ||