diff options
author | Johannes Weiner <jweiner@redhat.com> | 2012-01-12 20:18:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-12 23:13:06 -0500 |
commit | 72835c86ca15d0126354b73d5f29ce9194931c9b (patch) | |
tree | 369f31168b405e4d597b3cd067a1fd0ac2025dbc /mm/memcontrol.c | |
parent | ec0fffd84b162e0563a28a81aa049f946b31a8e2 (diff) |
mm: unify remaining mem_cont, mem, etc. variable names to memcg
Signed-off-by: Johannes Weiner <jweiner@redhat.com>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Hugh Dickins <hughd@google.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 | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index abb66a2cba65..aeb23933a052 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2844,12 +2844,12 @@ int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, | |||
2844 | */ | 2844 | */ |
2845 | int mem_cgroup_try_charge_swapin(struct mm_struct *mm, | 2845 | int mem_cgroup_try_charge_swapin(struct mm_struct *mm, |
2846 | struct page *page, | 2846 | struct page *page, |
2847 | gfp_t mask, struct mem_cgroup **ptr) | 2847 | gfp_t mask, struct mem_cgroup **memcgp) |
2848 | { | 2848 | { |
2849 | struct mem_cgroup *memcg; | 2849 | struct mem_cgroup *memcg; |
2850 | int ret; | 2850 | int ret; |
2851 | 2851 | ||
2852 | *ptr = NULL; | 2852 | *memcgp = NULL; |
2853 | 2853 | ||
2854 | if (mem_cgroup_disabled()) | 2854 | if (mem_cgroup_disabled()) |
2855 | return 0; | 2855 | return 0; |
@@ -2867,27 +2867,27 @@ int mem_cgroup_try_charge_swapin(struct mm_struct *mm, | |||
2867 | memcg = try_get_mem_cgroup_from_page(page); | 2867 | memcg = try_get_mem_cgroup_from_page(page); |
2868 | if (!memcg) | 2868 | if (!memcg) |
2869 | goto charge_cur_mm; | 2869 | goto charge_cur_mm; |
2870 | *ptr = memcg; | 2870 | *memcgp = memcg; |
2871 | ret = __mem_cgroup_try_charge(NULL, mask, 1, ptr, true); | 2871 | ret = __mem_cgroup_try_charge(NULL, mask, 1, memcgp, true); |
2872 | css_put(&memcg->css); | 2872 | css_put(&memcg->css); |
2873 | return ret; | 2873 | return ret; |
2874 | charge_cur_mm: | 2874 | charge_cur_mm: |
2875 | if (unlikely(!mm)) | 2875 | if (unlikely(!mm)) |
2876 | mm = &init_mm; | 2876 | mm = &init_mm; |
2877 | return __mem_cgroup_try_charge(mm, mask, 1, ptr, true); | 2877 | return __mem_cgroup_try_charge(mm, mask, 1, memcgp, true); |
2878 | } | 2878 | } |
2879 | 2879 | ||
2880 | static void | 2880 | static void |
2881 | __mem_cgroup_commit_charge_swapin(struct page *page, struct mem_cgroup *ptr, | 2881 | __mem_cgroup_commit_charge_swapin(struct page *page, struct mem_cgroup *memcg, |
2882 | enum charge_type ctype) | 2882 | enum charge_type ctype) |
2883 | { | 2883 | { |
2884 | if (mem_cgroup_disabled()) | 2884 | if (mem_cgroup_disabled()) |
2885 | return; | 2885 | return; |
2886 | if (!ptr) | 2886 | if (!memcg) |
2887 | return; | 2887 | return; |
2888 | cgroup_exclude_rmdir(&ptr->css); | 2888 | cgroup_exclude_rmdir(&memcg->css); |
2889 | 2889 | ||
2890 | __mem_cgroup_commit_charge_lrucare(page, ptr, ctype); | 2890 | __mem_cgroup_commit_charge_lrucare(page, memcg, ctype); |
2891 | /* | 2891 | /* |
2892 | * Now swap is on-memory. This means this page may be | 2892 | * Now swap is on-memory. This means this page may be |
2893 | * counted both as mem and swap....double count. | 2893 | * counted both as mem and swap....double count. |
@@ -2897,21 +2897,22 @@ __mem_cgroup_commit_charge_swapin(struct page *page, struct mem_cgroup *ptr, | |||
2897 | */ | 2897 | */ |
2898 | if (do_swap_account && PageSwapCache(page)) { | 2898 | if (do_swap_account && PageSwapCache(page)) { |
2899 | swp_entry_t ent = {.val = page_private(page)}; | 2899 | swp_entry_t ent = {.val = page_private(page)}; |
2900 | struct mem_cgroup *swap_memcg; | ||
2900 | unsigned short id; | 2901 | unsigned short id; |
2901 | struct mem_cgroup *memcg; | ||
2902 | 2902 | ||
2903 | id = swap_cgroup_record(ent, 0); | 2903 | id = swap_cgroup_record(ent, 0); |
2904 | rcu_read_lock(); | 2904 | rcu_read_lock(); |
2905 | memcg = mem_cgroup_lookup(id); | 2905 | swap_memcg = mem_cgroup_lookup(id); |
2906 | if (memcg) { | 2906 | if (swap_memcg) { |
2907 | /* | 2907 | /* |
2908 | * This recorded memcg can be obsolete one. So, avoid | 2908 | * This recorded memcg can be obsolete one. So, avoid |
2909 | * calling css_tryget | 2909 | * calling css_tryget |
2910 | */ | 2910 | */ |
2911 | if (!mem_cgroup_is_root(memcg)) | 2911 | if (!mem_cgroup_is_root(swap_memcg)) |
2912 | res_counter_uncharge(&memcg->memsw, PAGE_SIZE); | 2912 | res_counter_uncharge(&swap_memcg->memsw, |
2913 | mem_cgroup_swap_statistics(memcg, false); | 2913 | PAGE_SIZE); |
2914 | mem_cgroup_put(memcg); | 2914 | mem_cgroup_swap_statistics(swap_memcg, false); |
2915 | mem_cgroup_put(swap_memcg); | ||
2915 | } | 2916 | } |
2916 | rcu_read_unlock(); | 2917 | rcu_read_unlock(); |
2917 | } | 2918 | } |
@@ -2920,13 +2921,14 @@ __mem_cgroup_commit_charge_swapin(struct page *page, struct mem_cgroup *ptr, | |||
2920 | * So, rmdir()->pre_destroy() can be called while we do this charge. | 2921 | * So, rmdir()->pre_destroy() can be called while we do this charge. |
2921 | * In that case, we need to call pre_destroy() again. check it here. | 2922 | * In that case, we need to call pre_destroy() again. check it here. |
2922 | */ | 2923 | */ |
2923 | cgroup_release_and_wakeup_rmdir(&ptr->css); | 2924 | cgroup_release_and_wakeup_rmdir(&memcg->css); |
2924 | } | 2925 | } |
2925 | 2926 | ||
2926 | void mem_cgroup_commit_charge_swapin(struct page *page, struct mem_cgroup *ptr) | 2927 | void mem_cgroup_commit_charge_swapin(struct page *page, |
2928 | struct mem_cgroup *memcg) | ||
2927 | { | 2929 | { |
2928 | __mem_cgroup_commit_charge_swapin(page, ptr, | 2930 | __mem_cgroup_commit_charge_swapin(page, memcg, |
2929 | MEM_CGROUP_CHARGE_TYPE_MAPPED); | 2931 | MEM_CGROUP_CHARGE_TYPE_MAPPED); |
2930 | } | 2932 | } |
2931 | 2933 | ||
2932 | void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg) | 2934 | void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg) |
@@ -3255,14 +3257,14 @@ static inline int mem_cgroup_move_swap_account(swp_entry_t entry, | |||
3255 | * page belongs to. | 3257 | * page belongs to. |
3256 | */ | 3258 | */ |
3257 | int mem_cgroup_prepare_migration(struct page *page, | 3259 | int mem_cgroup_prepare_migration(struct page *page, |
3258 | struct page *newpage, struct mem_cgroup **ptr, gfp_t gfp_mask) | 3260 | struct page *newpage, struct mem_cgroup **memcgp, gfp_t gfp_mask) |
3259 | { | 3261 | { |
3260 | struct mem_cgroup *memcg = NULL; | 3262 | struct mem_cgroup *memcg = NULL; |
3261 | struct page_cgroup *pc; | 3263 | struct page_cgroup *pc; |
3262 | enum charge_type ctype; | 3264 | enum charge_type ctype; |
3263 | int ret = 0; | 3265 | int ret = 0; |
3264 | 3266 | ||
3265 | *ptr = NULL; | 3267 | *memcgp = NULL; |
3266 | 3268 | ||
3267 | VM_BUG_ON(PageTransHuge(page)); | 3269 | VM_BUG_ON(PageTransHuge(page)); |
3268 | if (mem_cgroup_disabled()) | 3270 | if (mem_cgroup_disabled()) |
@@ -3313,10 +3315,10 @@ int mem_cgroup_prepare_migration(struct page *page, | |||
3313 | if (!memcg) | 3315 | if (!memcg) |
3314 | return 0; | 3316 | return 0; |
3315 | 3317 | ||
3316 | *ptr = memcg; | 3318 | *memcgp = memcg; |
3317 | ret = __mem_cgroup_try_charge(NULL, gfp_mask, 1, ptr, false); | 3319 | ret = __mem_cgroup_try_charge(NULL, gfp_mask, 1, memcgp, false); |
3318 | css_put(&memcg->css);/* drop extra refcnt */ | 3320 | css_put(&memcg->css);/* drop extra refcnt */ |
3319 | if (ret || *ptr == NULL) { | 3321 | if (ret || *memcgp == NULL) { |
3320 | if (PageAnon(page)) { | 3322 | if (PageAnon(page)) { |
3321 | lock_page_cgroup(pc); | 3323 | lock_page_cgroup(pc); |
3322 | ClearPageCgroupMigration(pc); | 3324 | ClearPageCgroupMigration(pc); |