Commit cf2c8127 authored by Johannes Weiner's avatar Johannes Weiner Committed by Linus Torvalds

mm: memcontrol: remove unnecessary memcg argument from soft limit functions

Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
Cc: Jianyu Zhan <nasa4836@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e231875b
...@@ -713,9 +713,7 @@ soft_limit_tree_from_page(struct page *page) ...@@ -713,9 +713,7 @@ soft_limit_tree_from_page(struct page *page)
return &soft_limit_tree.rb_tree_per_node[nid]->rb_tree_per_zone[zid]; return &soft_limit_tree.rb_tree_per_node[nid]->rb_tree_per_zone[zid];
} }
static void static void __mem_cgroup_insert_exceeded(struct mem_cgroup_per_zone *mz,
__mem_cgroup_insert_exceeded(struct mem_cgroup *memcg,
struct mem_cgroup_per_zone *mz,
struct mem_cgroup_tree_per_zone *mctz, struct mem_cgroup_tree_per_zone *mctz,
unsigned long long new_usage_in_excess) unsigned long long new_usage_in_excess)
{ {
...@@ -747,9 +745,7 @@ __mem_cgroup_insert_exceeded(struct mem_cgroup *memcg, ...@@ -747,9 +745,7 @@ __mem_cgroup_insert_exceeded(struct mem_cgroup *memcg,
mz->on_tree = true; mz->on_tree = true;
} }
static void static void __mem_cgroup_remove_exceeded(struct mem_cgroup_per_zone *mz,
__mem_cgroup_remove_exceeded(struct mem_cgroup *memcg,
struct mem_cgroup_per_zone *mz,
struct mem_cgroup_tree_per_zone *mctz) struct mem_cgroup_tree_per_zone *mctz)
{ {
if (!mz->on_tree) if (!mz->on_tree)
...@@ -758,13 +754,11 @@ __mem_cgroup_remove_exceeded(struct mem_cgroup *memcg, ...@@ -758,13 +754,11 @@ __mem_cgroup_remove_exceeded(struct mem_cgroup *memcg,
mz->on_tree = false; mz->on_tree = false;
} }
static void static void mem_cgroup_remove_exceeded(struct mem_cgroup_per_zone *mz,
mem_cgroup_remove_exceeded(struct mem_cgroup *memcg,
struct mem_cgroup_per_zone *mz,
struct mem_cgroup_tree_per_zone *mctz) struct mem_cgroup_tree_per_zone *mctz)
{ {
spin_lock(&mctz->lock); spin_lock(&mctz->lock);
__mem_cgroup_remove_exceeded(memcg, mz, mctz); __mem_cgroup_remove_exceeded(mz, mctz);
spin_unlock(&mctz->lock); spin_unlock(&mctz->lock);
} }
...@@ -791,12 +785,12 @@ static void mem_cgroup_update_tree(struct mem_cgroup *memcg, struct page *page) ...@@ -791,12 +785,12 @@ static void mem_cgroup_update_tree(struct mem_cgroup *memcg, struct page *page)
spin_lock(&mctz->lock); spin_lock(&mctz->lock);
/* if on-tree, remove it */ /* if on-tree, remove it */
if (mz->on_tree) if (mz->on_tree)
__mem_cgroup_remove_exceeded(memcg, mz, mctz); __mem_cgroup_remove_exceeded(mz, mctz);
/* /*
* Insert again. mz->usage_in_excess will be updated. * Insert again. mz->usage_in_excess will be updated.
* If excess is 0, no tree ops. * If excess is 0, no tree ops.
*/ */
__mem_cgroup_insert_exceeded(memcg, mz, mctz, excess); __mem_cgroup_insert_exceeded(mz, mctz, excess);
spin_unlock(&mctz->lock); spin_unlock(&mctz->lock);
} }
} }
...@@ -812,7 +806,7 @@ static void mem_cgroup_remove_from_trees(struct mem_cgroup *memcg) ...@@ -812,7 +806,7 @@ static void mem_cgroup_remove_from_trees(struct mem_cgroup *memcg)
for (zid = 0; zid < MAX_NR_ZONES; zid++) { for (zid = 0; zid < MAX_NR_ZONES; zid++) {
mz = &memcg->nodeinfo[nid]->zoneinfo[zid]; mz = &memcg->nodeinfo[nid]->zoneinfo[zid];
mctz = soft_limit_tree_node_zone(nid, zid); mctz = soft_limit_tree_node_zone(nid, zid);
mem_cgroup_remove_exceeded(memcg, mz, mctz); mem_cgroup_remove_exceeded(mz, mctz);
} }
} }
} }
...@@ -835,7 +829,7 @@ __mem_cgroup_largest_soft_limit_node(struct mem_cgroup_tree_per_zone *mctz) ...@@ -835,7 +829,7 @@ __mem_cgroup_largest_soft_limit_node(struct mem_cgroup_tree_per_zone *mctz)
* we will to add it back at the end of reclaim to its correct * we will to add it back at the end of reclaim to its correct
* position in the tree. * position in the tree.
*/ */
__mem_cgroup_remove_exceeded(mz->memcg, mz, mctz); __mem_cgroup_remove_exceeded(mz, mctz);
if (!res_counter_soft_limit_excess(&mz->memcg->res) || if (!res_counter_soft_limit_excess(&mz->memcg->res) ||
!css_tryget(&mz->memcg->css)) !css_tryget(&mz->memcg->css))
goto retry; goto retry;
...@@ -4586,7 +4580,7 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, ...@@ -4586,7 +4580,7 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
break; break;
} while (1); } while (1);
} }
__mem_cgroup_remove_exceeded(mz->memcg, mz, mctz); __mem_cgroup_remove_exceeded(mz, mctz);
excess = res_counter_soft_limit_excess(&mz->memcg->res); excess = res_counter_soft_limit_excess(&mz->memcg->res);
/* /*
* One school of thought says that we should not add * One school of thought says that we should not add
...@@ -4597,7 +4591,7 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, ...@@ -4597,7 +4591,7 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
* term TODO. * term TODO.
*/ */
/* If excess == 0, no tree ops */ /* If excess == 0, no tree ops */
__mem_cgroup_insert_exceeded(mz->memcg, mz, mctz, excess); __mem_cgroup_insert_exceeded(mz, mctz, excess);
spin_unlock(&mctz->lock); spin_unlock(&mctz->lock);
css_put(&mz->memcg->css); css_put(&mz->memcg->css);
loop++; loop++;
......
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