From wkevils@gmail.com Sun Jan 31 03:18:59 2016 From: Kevin Wilson To: kernelnewbies@kernelnewbies.org Subject: swap test for cgroups Date: Sun, 31 Jan 2016 10:18:57 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8252759003045155873==" --===============8252759003045155873== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Hi, I had tried to perform the following test according to: http://lxr.free-electrons.com/source/Documentation/cgroups/memcg_test.txt#L211 mkdir /sys/fs/cgroup/memory/group1 echo $$ > /sys/fs/cgroup/memory/group1/cgroup.procs echo 40M > /sys/fs/cgroup/memory/group1/memory.limit_in_bytes Run a process which is a very short program, allocating 100MB: int main() { // Allocate 100 MB void *mem = malloc(1024*1024*100); if (mem) printf("malloc is ok\n"); pause(); } VmSize seems a bit larger than 100MB, and this seems ok, when adding the overhead of running a process: cat /proc/$$/status | grep VmSize VmSize: 116920 kB cat /sys/fs/cgroup/memory/group1/memory.stat | grep swap swap 0 total_swap 0 cat /proc/$$/status | grep -i swap VmSwap: 0 kB I would expect that the swap will be 60M according to the link to the memcg_test.txt mentioned earlier. Any ideas ? Regards, Kevin --===============8252759003045155873==-- From mulyadi.santosa@gmail.com Mon Feb 1 03:43:39 2016 From: Mulyadi Santosa To: kernelnewbies@kernelnewbies.org Subject: Re: swap test for cgroups Date: Mon, 01 Feb 2016 15:42:57 +0700 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1535789768618262299==" --===============1535789768618262299== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Sun, Jan 31, 2016 at 3:18 PM, Kevin Wilson wrote: > Hi, > > I had tried to perform the following test according to: > http://lxr.free-electrons.com/source/Documentation/cgroups/memcg_test.txt#L= 211 > mkdir /sys/fs/cgroup/memory/group1 > > echo $$ > /sys/fs/cgroup/memory/group1/cgroup.procs Hi... maybe you should test with "echo 0" like mentioned in the example? IMHO, echo $$ will yield PID of your current PID of task invocation in bash, and I think that's different with the PID of malloc program you ran. hence the result you saw > > echo 40M > /sys/fs/cgroup/memory/group1/memory.limit_in_bytes > > Run a process which is a very short program, allocating 100MB: > int main() { > // Allocate 100 MB > void *mem =3D malloc(1024*1024*100); > if (mem) > printf("malloc is ok\n"); > pause(); > } > > > VmSize seems a bit larger than 100MB, and this seems ok, when adding > the overhead of running a process: > cat /proc/$$/status | grep VmSize > VmSize: 116920 kB > > > > cat /sys/fs/cgroup/memory/group1/memory.stat | grep swap > swap 0 > total_swap 0 > > cat /proc/$$/status | grep -i swap > VmSwap: 0 kB > > > I would expect that the swap will be 60M according to the link to the > memcg_test.txt mentioned earlier. > > Any ideas ? > > Regards, > Kevin > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies@kernelnewbies.org > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --=20 regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
This email has been sent from a virus-free computer protected by Avast.
www.avast.com
--===============1535789768618262299==--