[Devel] [PATCH] memcg: Do not open code accesses to res_counter members

Glauber Costa glommer at parallels.com
Tue Mar 20 09:53:44 PDT 2012


We should use the acessor res_counter_read_u64 for that.
Although a purely cosmetic change is sometimes better of 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: Glauber Costa <glommer at parallels.com>
Cc: Johannes Weiner <hannes at cmpxchg.org>
Cc: Michal Hocko <mhocko at suse.cz>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu at jp.fujitsu.com>
---
 mm/memcontrol.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 87a1e21..27c1bfa 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3708,7 +3708,7 @@ move_account:
 			goto try_to_free;
 		cond_resched();
 	/* "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:
 	css_put(&memcg->css);
 	return ret;
@@ -3723,7 +3723,7 @@ try_to_free:
 	lru_add_drain_all();
 	/* try to free all pages in this cgroup */
 	shrink = 1;
-	while (nr_retries && memcg->res.usage > 0) {
+	while (nr_retries && res_counter_read_u64(&memcg->res, RES_USAGE) > 0) {
 		int progress;
 
 		if (signal_pending(current)) {
-- 
1.7.7.6




More information about the Devel mailing list