public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Andre Nathan <andre@digirati.com.br>
Cc: linux-kernel@vger.kernel.org, balbir@linux.vnet.ibm.com
Subject: Re: About cgroup memory limits
Date: Thu, 10 May 2012 18:47:33 +0900	[thread overview]
Message-ID: <4FAB8EB5.8080901@jp.fujitsu.com> (raw)
In-Reply-To: <1336588657.26723.23.camel@andre>

(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,

rss + cache < limit.

cache - mapped_file == unmapped file caches.


> I am also trying to understand the values reported in memory.stat when
> compared to the statistics in /proc/$PID/statm.
> 
> Below is the sum of each field in /proc/$PID/statm for every process
> running inside a test container, converted to bytes:
> 
>        size  resident     share     text  lib       data  dt
>   897208320  28741632  20500480  1171456    0  170676224   0
> 

from statm source code.

size      = total virtual memory size
            # total amount of mmaps().

shared    = mapped_file
            # resident mapped file caches

text      = end_code - start_code
            # end_code and start_code is determined when the program is loaded.
            # this is virtual memory size.

data      = total virtual memory size  - MAP_SHARED virtual memory size.

regisdent = anonymous pages + mapped_file.


> Compare this with the usage reports from memory.stat (fields total_*,
> hierarchical_* and pg* omitted):
> 
> cache                     16834560
> rss                       8192000
> mapped_file               3743744
> swap                      0
> inactive_anon             0
> active_anon               8192000
> inactive_file             13996032
> active_file               2838528
> unevictable               0
> 
> Is there a way to reconcile these numbers somehow? I understand that the
> fields from the two files represent different things. What I'm trying to
> do is to combine, for example, the fields from memory.stat to
> approximately reach what is displayed by statm.
> 


>From above, rss + mapped_file == resident.

Thanks,
-Kame



  reply	other threads:[~2012-05-10  9:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-09 18:37 About cgroup memory limits Andre Nathan
2012-05-10  9:47 ` KAMEZAWA Hiroyuki [this message]
2012-05-10 10:55   ` Andre Nathan
2012-05-11  0:30     ` KAMEZAWA Hiroyuki
2012-05-25  4:16   ` Zhu Yanhai
2012-05-25  4:58     ` Kamezawa Hiroyuki
2012-05-25  6:11       ` Zhu Yanhai
     [not found] ` <CAKTCnz=0vihGLXQx+C_9399018eJ1hfRHUk21fE=2i_emLzBAw@mail.gmail.com>
2012-05-15 11:07   ` Balbir Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FAB8EB5.8080901@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=andre@digirati.com.br \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox