aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2013-10-31 19:34:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-10-31 19:58:13 -0400
commit0056f4e66a1b8f00245248877e80386af36af14c (patch)
tree1113e39ea47376d1d0071abf75bf336441e5cc26
parent3168ecbe1c04ec3feb7cb42388a17d7f047fe1a2 (diff)
mm: memcg: lockdep annotation for memcg OOM lock
The memcg OOM lock is a mutex-type lock that is open-coded due to memcg's special needs. Add annotations for lockdep coverage. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/memcontrol.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 623d5c8bb1e1..7e11cb7d75b1 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -54,6 +54,7 @@
54#include <linux/page_cgroup.h> 54#include <linux/page_cgroup.h>
55#include <linux/cpu.h> 55#include <linux/cpu.h>
56#include <linux/oom.h> 56#include <linux/oom.h>
57#include <linux/lockdep.h>
57#include "internal.h" 58#include "internal.h"
58#include <net/sock.h> 59#include <net/sock.h>
59#include <net/ip.h> 60#include <net/ip.h>
@@ -2046,6 +2047,12 @@ static int mem_cgroup_soft_reclaim(struct mem_cgroup *root_memcg,
2046 return total; 2047 return total;
2047} 2048}
2048 2049
2050#ifdef CONFIG_LOCKDEP
2051static struct lockdep_map memcg_oom_lock_dep_map = {
2052 .name = "memcg_oom_lock",
2053};
2054#endif
2055
2049static DEFINE_SPINLOCK(memcg_oom_lock); 2056static DEFINE_SPINLOCK(memcg_oom_lock);
2050 2057
2051/* 2058/*
@@ -2083,7 +2090,8 @@ static bool mem_cgroup_oom_trylock(struct mem_cgroup *memcg)
2083 } 2090 }
2084 iter->oom_lock = false; 2091 iter->oom_lock = false;
2085 } 2092 }
2086 } 2093 } else
2094 mutex_acquire(&memcg_oom_lock_dep_map, 0, 1, _RET_IP_);
2087 2095
2088 spin_unlock(&memcg_oom_lock); 2096 spin_unlock(&memcg_oom_lock);
2089 2097
@@ -2095,6 +2103,7 @@ static void mem_cgroup_oom_unlock(struct mem_cgroup *memcg)
2095 struct mem_cgroup *iter; 2103 struct mem_cgroup *iter;
2096 2104
2097 spin_lock(&memcg_oom_lock); 2105 spin_lock(&memcg_oom_lock);
2106 mutex_release(&memcg_oom_lock_dep_map, 1, _RET_IP_);
2098 for_each_mem_cgroup_tree(iter, memcg) 2107 for_each_mem_cgroup_tree(iter, memcg)
2099 iter->oom_lock = false; 2108 iter->oom_lock = false;
2100 spin_unlock(&memcg_oom_lock); 2109 spin_unlock(&memcg_oom_lock);