Re: [PATCH 2/7] memcg : use CSS ID in memcg

From: KAMEZAWA Hiroyuki
Date: Fri Jan 23 2009 - 04:50:22 EST


Daisuke Nishimura さんは書きました:
> On Thu, 22 Jan 2009 18:35:57 +0900, KAMEZAWA Hiroyuki
> <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
>>
>> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
>> Use css ID in memcg.
>>
>> Assigning CSS ID for each memcg and use css_get_next() for scanning
>> hierarchy.
>>
>> Assume folloing tree.
>>
>> group_A (ID=3)
>> /01 (ID=4)
>> /0A (ID=7)
>> /02 (ID=10)
>> group_B (ID=5)
>> and task in group_A/01/0A hits limit at group_A.
>>
>> reclaim will be done in following order (round-robin).
>> group_A(3) -> group_A/01 (4) -> group_A/01/0A (7) -> group_A/02(10)
>> -> group_A -> .....
>>
>> Round robin by ID. The last visited cgroup is recorded and restart
>> from it when it start reclaim again.
>> (More smart algorithm can be implemented..)
>>
>> No cgroup_mutex or hierarchy_mutex is required.
>>
>> Changelog (v3) -> (v4)
>> - dropped css_is_populated() check
>> - removed scan_age and use more simple logic.
>>
> I think a check for mem_cgroup_local_usage is also added by this version
> :)
>
>> Changelog (v2) -> (v3)
>> - Added css_is_populatd() check
>> - Adjusted to rc1 + Nishimrua's fixes.
>> - Increased comments.
>>
>> Changelog (v1) -> (v2)
>> - Updated texts.
>>
>> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
>>
>> ---
>> mm/memcontrol.c | 220
>> ++++++++++++++++++++------------------------------------
>> 1 file changed, 82 insertions(+), 138 deletions(-)
>>
>> Index: mmotm-2.6.29-Jan16/mm/memcontrol.c
>> ===================================================================
>> --- mmotm-2.6.29-Jan16.orig/mm/memcontrol.c
>> +++ mmotm-2.6.29-Jan16/mm/memcontrol.c
>> @@ -95,6 +95,15 @@ static s64 mem_cgroup_read_stat(struct m
>> return ret;
>> }
>>
>> +static s64 mem_cgroup_local_usage(struct mem_cgroup_stat *stat)
>> +{
>> + s64 ret;
>> +
> It would be better to initialize it to 0.
>
Hmm ? why ?
> Reviewed-by: Daisuke Nishimura <nishimura@xxxxxxxxxxxxxxxxx>
>
> Thanks,
> Daisuke Nishimura.
>

Thanks,
-Kame


>> + ret = mem_cgroup_read_stat(stat, MEM_CGROUP_STAT_CACHE);
>> + ret += mem_cgroup_read_stat(stat, MEM_CGROUP_STAT_RSS);
>> + return ret;
>> +}
>> +


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/