Re: About cgroup memory limits

From: Zhu Yanhai
Date: Fri May 25 2012 - 02:11:54 EST


2012/5/25 Kamezawa Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>:
> (2012/05/25 13:16), Zhu Yanhai wrote:
>>
>> 2012/5/10 KAMEZAWA Hiroyuki<kamezawa.hiroyu@xxxxxxxxxxxxxx>:
>>>
>>> (2012/05/10 3:37), Andre Nathan wrote:
>>>
>>>> Hello
>>>>
>>>> I'm doing some tests with LXC and how it interacts with the memory
>>>> cgroup limits, more specifically the memory.limit_in_bytes control file.
>>>>
>>>> Am I correct in my understanding of the memory cgroup documentation[1]
>>>> that the limit set in memory.limit_in_bytes is applied to the sum of the
>>>> fields 'cache', 'rss' and 'mapped_file' in the memory.stat file?
>>>>
>>>
>>> cache includes mapped_file. Then,
>>
>>
>> Excuse me, but it does read:
>>
>> Â Â Â Âswitch (ctype) {
>> Â Â Â Âcase MEM_CGROUP_CHARGE_TYPE_CACHE:
>> Â Â Â Âcase MEM_CGROUP_CHARGE_TYPE_SHMEM:
>> Â Â Â Â Â Â Â ÂSetPageCgroupCache(pc);
>> Â Â Â Â Â Â Â ÂSetPageCgroupUsed(pc);
>> Â Â Â Â Â Â Â Âbreak;
>> Â Â Â Âcase MEM_CGROUP_CHARGE_TYPE_MAPPED:
>> Â Â Â Â Â Â Â ÂClearPageCgroupCache(pc);
>> Â Â Â Â Â Â Â ÂSetPageCgroupUsed(pc);
>> Â Â Â Â Â Â Â Âbreak;
>> Â Â Â Âdefault:
>> Â Â Â Â Â Â Â Âbreak;
>> Â Â Â Â}
>> Â Â Â Âmem_cgroup_charge_statistics(mem, pc, page_size);
>>
>> And then, in  Âmem_cgroup_charge_statistics() we have :
>>
>> Â Â Â Âif (PageCgroupCache(pc))
>> Â Â Â Â Â Â Â Â__mem_cgroup_stat_add_safe(cpustat,
>> Â Â Â Â Â Â Â Â Â Â Â ÂMEM_CGROUP_STAT_CACHE, numpages);
>> Â Â Â Âelse
>> Â Â Â Â Â Â Â Â__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_RSS,
>> Â Â Â Â Â Â Â Â Â Â Â Ânumpages);
>>
>> So it seems that rss includes mapped_file, not cache?
>>
> Why you think so ? mapped_file is mapped file cache. All file caches
> are accountned as STAT_CACHE.
>
>
> TYPE_MAPPDED doesn't mean mapped_file.
> In above, TYPE_MAPPED is called via anonymous page fault.
> It represents anonymous page, counted as RSS.
> I wonder it may be better to rename these macros.

Got it, really get confused by the name! Thanks.
>
>
> Thanks,
> -Kame
>
>
--
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/