diff options
author | Bob Liu <lliubbo@gmail.com> | 2012-01-12 20:18:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-12 23:13:07 -0500 |
commit | 9fb4b7cc0724f178d4b24a2a566ea1e7cb120b82 (patch) | |
tree | 0f2db9102d46f5e5c8492864fb1bd21f2e7cd768 /mm/memcontrol.c | |
parent | 40f23a21a8501c1b2c65c50c19b516488ac31313 (diff) |
page_cgroup: add helper function to get swap_cgroup
There are multiple places which need to get the swap_cgroup address, so
add a helper function:
static struct swap_cgroup *swap_cgroup_getsc(swp_entry_t ent,
struct swap_cgroup_ctrl **ctrl);
to simplify the code.
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Johannes Weiner <jweiner@redhat.com>
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 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 71a9774e6ead..4c53e971749e 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2474,7 +2474,7 @@ struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page) | |||
2474 | memcg = NULL; | 2474 | memcg = NULL; |
2475 | } else if (PageSwapCache(page)) { | 2475 | } else if (PageSwapCache(page)) { |
2476 | ent.val = page_private(page); | 2476 | ent.val = page_private(page); |
2477 | id = lookup_swap_cgroup(ent); | 2477 | id = lookup_swap_cgroup_id(ent); |
2478 | rcu_read_lock(); | 2478 | rcu_read_lock(); |
2479 | memcg = mem_cgroup_lookup(id); | 2479 | memcg = mem_cgroup_lookup(id); |
2480 | if (memcg && !css_tryget(&memcg->css)) | 2480 | if (memcg && !css_tryget(&memcg->css)) |
@@ -5264,7 +5264,7 @@ static int is_target_pte_for_mc(struct vm_area_struct *vma, | |||
5264 | } | 5264 | } |
5265 | /* There is a swap entry and a page doesn't exist or isn't charged */ | 5265 | /* There is a swap entry and a page doesn't exist or isn't charged */ |
5266 | if (ent.val && !ret && | 5266 | if (ent.val && !ret && |
5267 | css_id(&mc.from->css) == lookup_swap_cgroup(ent)) { | 5267 | css_id(&mc.from->css) == lookup_swap_cgroup_id(ent)) { |
5268 | ret = MC_TARGET_SWAP; | 5268 | ret = MC_TARGET_SWAP; |
5269 | if (target) | 5269 | if (target) |
5270 | target->ent = ent; | 5270 | target->ent = ent; |