[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090115151936.9836878f.kamezawa.hiroyu@jp.fujitsu.com>
Date: Thu, 15 Jan 2009 15:19:36 +0900
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To: balbir@...ux.vnet.ibm.com
Cc: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>,
"lizf@...fujitsu.com" <lizf@...fujitsu.com>,
"menage@...gle.com" <menage@...gle.com>
Subject: Re: [RFC][PATCH 2/4] memcg: use CSS ID in memcg
On Mon, 12 Jan 2009 17:44:24 +0530
Balbir Singh <balbir@...ux.vnet.ibm.com> wrote:
get_swappiness(next_mem));
> > + struct mem_cgroup *victim;
> > + unsigned long start_age;
> > + int ret, total = 0;
> > + /*
> > + * Reclaim memory from cgroups under root_mem in round robin.
> > + */
> > + start_age = root_mem->scan_age;
> > +
> > + while (time_after((start_age + 2UL), root_mem->scan_age)) {
>
> This is confusing, why do we use time_after with scan_age. scan_age
> seems to be incremented every time we scan and has no relationship
> with time.
time_after() is useful macro for checking counter which can go MAX-1->MAX->0->1>...
> The second thing is what happens if time_after() always
> returns 0, if we've been aggressively scanning?
That never happens.
> The logic needs some commenting, why the magic number 2?
>
memcg->scan_age is update when
- the memcg is root of hierarchy.
- we reclaim memory from memcg.
So, memcg->scan_age is update by 2 means, all memcg under hierarchy is accessed
by reclaim routine.
example) Consider hierarhy like this.
xxx(ID=8)
/yyy (ID=4)
/zzz (ID=9)
/www (ID=3)
In this case, scan will be done in following order
.....->3->4->8->9->3->4->8->9->...
(start point is determined by last_scanned_child)
everytime we visit "8", 8's scan_age is updated.
So, if we see "8" 2 times, all other groups 4,9,3 is all accessed for freeing
memory. (by me or other threads.)
-Kame
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists