Commit 73045c47 authored by Daisuke Nishimura's avatar Daisuke Nishimura Committed by Linus Torvalds

memcg: remove mem from arg of charge_common

mem_cgroup_charge_common() is always called with @mem = NULL, so it's
meaningless.  This patch removes it.
Signed-off-by: default avatarDaisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent bd0d24bf
...@@ -2018,10 +2018,9 @@ static int mem_cgroup_move_parent(struct page_cgroup *pc, ...@@ -2018,10 +2018,9 @@ static int mem_cgroup_move_parent(struct page_cgroup *pc,
* < 0 if the cgroup is over its limit * < 0 if the cgroup is over its limit
*/ */
static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm, static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm,
gfp_t gfp_mask, enum charge_type ctype, gfp_t gfp_mask, enum charge_type ctype)
struct mem_cgroup *memcg)
{ {
struct mem_cgroup *mem; struct mem_cgroup *mem = NULL;
struct page_cgroup *pc; struct page_cgroup *pc;
int ret; int ret;
...@@ -2031,7 +2030,6 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm, ...@@ -2031,7 +2030,6 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm,
return 0; return 0;
prefetchw(pc); prefetchw(pc);
mem = memcg;
ret = __mem_cgroup_try_charge(mm, gfp_mask, &mem, true); ret = __mem_cgroup_try_charge(mm, gfp_mask, &mem, true);
if (ret || !mem) if (ret || !mem)
return ret; return ret;
...@@ -2059,7 +2057,7 @@ int mem_cgroup_newpage_charge(struct page *page, ...@@ -2059,7 +2057,7 @@ int mem_cgroup_newpage_charge(struct page *page,
if (unlikely(!mm)) if (unlikely(!mm))
mm = &init_mm; mm = &init_mm;
return mem_cgroup_charge_common(page, mm, gfp_mask, return mem_cgroup_charge_common(page, mm, gfp_mask,
MEM_CGROUP_CHARGE_TYPE_MAPPED, NULL); MEM_CGROUP_CHARGE_TYPE_MAPPED);
} }
static void static void
...@@ -2069,7 +2067,6 @@ __mem_cgroup_commit_charge_swapin(struct page *page, struct mem_cgroup *ptr, ...@@ -2069,7 +2067,6 @@ __mem_cgroup_commit_charge_swapin(struct page *page, struct mem_cgroup *ptr,
int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
gfp_t gfp_mask) gfp_t gfp_mask)
{ {
struct mem_cgroup *mem = NULL;
int ret; int ret;
if (mem_cgroup_disabled()) if (mem_cgroup_disabled())
...@@ -2101,22 +2098,24 @@ int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, ...@@ -2101,22 +2098,24 @@ int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
unlock_page_cgroup(pc); unlock_page_cgroup(pc);
} }
if (unlikely(!mm && !mem)) if (unlikely(!mm))
mm = &init_mm; mm = &init_mm;
if (page_is_file_cache(page)) if (page_is_file_cache(page))
return mem_cgroup_charge_common(page, mm, gfp_mask, return mem_cgroup_charge_common(page, mm, gfp_mask,
MEM_CGROUP_CHARGE_TYPE_CACHE, NULL); MEM_CGROUP_CHARGE_TYPE_CACHE);
/* shmem */ /* shmem */
if (PageSwapCache(page)) { if (PageSwapCache(page)) {
struct mem_cgroup *mem = NULL;
ret = mem_cgroup_try_charge_swapin(mm, page, gfp_mask, &mem); ret = mem_cgroup_try_charge_swapin(mm, page, gfp_mask, &mem);
if (!ret) if (!ret)
__mem_cgroup_commit_charge_swapin(page, mem, __mem_cgroup_commit_charge_swapin(page, mem,
MEM_CGROUP_CHARGE_TYPE_SHMEM); MEM_CGROUP_CHARGE_TYPE_SHMEM);
} else } else
ret = mem_cgroup_charge_common(page, mm, gfp_mask, ret = mem_cgroup_charge_common(page, mm, gfp_mask,
MEM_CGROUP_CHARGE_TYPE_SHMEM, mem); MEM_CGROUP_CHARGE_TYPE_SHMEM);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment