lkml.org 
[lkml]   [2009]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 2/4] memcg: use CSS ID in memcg
On Mon, 12 Jan 2009 17:44:24 +0530
Balbir Singh <balbir@linux.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



\
 
 \ /
  Last update: 2009-01-15 07:23    [W:0.095 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site