diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2014-12-10 18:44:05 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 20:41:07 -0500 |
commit | 354a4783a2ee5ba1cb5a1442cca8ecd4c0ac6d66 (patch) | |
tree | 14625d649328aaa9a568688d7f8c94689ce91bc0 /mm/memcontrol.c | |
parent | 2983331575bfb248abfb02efb5140b4a299e3f45 (diff) |
mm: memcontrol: inline memcg->move_lock locking
The wrappers around taking and dropping the memcg->move_lock spinlock add
nothing of value. Inline the spinlock calls into the callsites.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Vladimir Davydov <vdavydov@parallels.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 09fece0eb9f1..a5c9aa4688e8 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1522,23 +1522,6 @@ static bool mem_cgroup_wait_acct_move(struct mem_cgroup *memcg) | |||
1522 | return false; | 1522 | return false; |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | /* | ||
1526 | * Take this lock when | ||
1527 | * - a code tries to modify page's memcg while it's USED. | ||
1528 | * - a code tries to modify page state accounting in a memcg. | ||
1529 | */ | ||
1530 | static void move_lock_mem_cgroup(struct mem_cgroup *memcg, | ||
1531 | unsigned long *flags) | ||
1532 | { | ||
1533 | spin_lock_irqsave(&memcg->move_lock, *flags); | ||
1534 | } | ||
1535 | |||
1536 | static void move_unlock_mem_cgroup(struct mem_cgroup *memcg, | ||
1537 | unsigned long *flags) | ||
1538 | { | ||
1539 | spin_unlock_irqrestore(&memcg->move_lock, *flags); | ||
1540 | } | ||
1541 | |||
1542 | #define K(x) ((x) << (PAGE_SHIFT-10)) | 1525 | #define K(x) ((x) << (PAGE_SHIFT-10)) |
1543 | /** | 1526 | /** |
1544 | * mem_cgroup_print_oom_info: Print OOM information relevant to memory controller. | 1527 | * mem_cgroup_print_oom_info: Print OOM information relevant to memory controller. |
@@ -2156,9 +2139,9 @@ again: | |||
2156 | if (atomic_read(&memcg->moving_account) <= 0) | 2139 | if (atomic_read(&memcg->moving_account) <= 0) |
2157 | return memcg; | 2140 | return memcg; |
2158 | 2141 | ||
2159 | move_lock_mem_cgroup(memcg, flags); | 2142 | spin_lock_irqsave(&memcg->move_lock, *flags); |
2160 | if (memcg != pc->mem_cgroup) { | 2143 | if (memcg != pc->mem_cgroup) { |
2161 | move_unlock_mem_cgroup(memcg, flags); | 2144 | spin_unlock_irqrestore(&memcg->move_lock, *flags); |
2162 | goto again; | 2145 | goto again; |
2163 | } | 2146 | } |
2164 | *locked = true; | 2147 | *locked = true; |
@@ -2176,7 +2159,7 @@ void mem_cgroup_end_page_stat(struct mem_cgroup *memcg, bool locked, | |||
2176 | unsigned long flags) | 2159 | unsigned long flags) |
2177 | { | 2160 | { |
2178 | if (memcg && locked) | 2161 | if (memcg && locked) |
2179 | move_unlock_mem_cgroup(memcg, &flags); | 2162 | spin_unlock_irqrestore(&memcg->move_lock, flags); |
2180 | 2163 | ||
2181 | rcu_read_unlock(); | 2164 | rcu_read_unlock(); |
2182 | } | 2165 | } |
@@ -3219,7 +3202,7 @@ static int mem_cgroup_move_account(struct page *page, | |||
3219 | if (pc->mem_cgroup != from) | 3202 | if (pc->mem_cgroup != from) |
3220 | goto out_unlock; | 3203 | goto out_unlock; |
3221 | 3204 | ||
3222 | move_lock_mem_cgroup(from, &flags); | 3205 | spin_lock_irqsave(&from->move_lock, flags); |
3223 | 3206 | ||
3224 | if (!PageAnon(page) && page_mapped(page)) { | 3207 | if (!PageAnon(page) && page_mapped(page)) { |
3225 | __this_cpu_sub(from->stat->count[MEM_CGROUP_STAT_FILE_MAPPED], | 3208 | __this_cpu_sub(from->stat->count[MEM_CGROUP_STAT_FILE_MAPPED], |
@@ -3243,7 +3226,8 @@ static int mem_cgroup_move_account(struct page *page, | |||
3243 | 3226 | ||
3244 | /* caller should have done css_get */ | 3227 | /* caller should have done css_get */ |
3245 | pc->mem_cgroup = to; | 3228 | pc->mem_cgroup = to; |
3246 | move_unlock_mem_cgroup(from, &flags); | 3229 | spin_unlock_irqrestore(&from->move_lock, flags); |
3230 | |||
3247 | ret = 0; | 3231 | ret = 0; |
3248 | 3232 | ||
3249 | local_irq_disable(); | 3233 | local_irq_disable(); |