Commit 569530fb authored by Glauber Costa's avatar Glauber Costa Committed by Linus Torvalds

memcg: do not open code accesses to res_counter members

We should use the accessor res_counter_read_u64 for that.

Although a purely cosmetic change is sometimes better delayed, to avoid
conflicting with other people's work, we are starting to have people
touching this code as well, and reproducing the open code behavior
because that's the standard =)

Time to fix it, then.
Signed-off-by: default avatarGlauber Costa <glommer@parallels.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
Cc: KAMEZAWA 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 32050017
...@@ -3763,7 +3763,7 @@ static int mem_cgroup_force_empty(struct mem_cgroup *memcg, bool free_all) ...@@ -3763,7 +3763,7 @@ static int mem_cgroup_force_empty(struct mem_cgroup *memcg, bool free_all)
goto try_to_free; goto try_to_free;
cond_resched(); cond_resched();
/* "ret" should also be checked to ensure all lists are empty. */ /* "ret" should also be checked to ensure all lists are empty. */
} while (memcg->res.usage > 0 || ret); } while (res_counter_read_u64(&memcg->res, RES_USAGE) > 0 || ret);
out: out:
css_put(&memcg->css); css_put(&memcg->css);
return ret; return ret;
...@@ -3778,7 +3778,7 @@ static int mem_cgroup_force_empty(struct mem_cgroup *memcg, bool free_all) ...@@ -3778,7 +3778,7 @@ static int mem_cgroup_force_empty(struct mem_cgroup *memcg, bool free_all)
lru_add_drain_all(); lru_add_drain_all();
/* try to free all pages in this cgroup */ /* try to free all pages in this cgroup */
shrink = 1; shrink = 1;
while (nr_retries && memcg->res.usage > 0) { while (nr_retries && res_counter_read_u64(&memcg->res, RES_USAGE) > 0) {
int progress; int progress;
if (signal_pending(current)) { if (signal_pending(current)) {
......
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