lkml.org 
[lkml]   [2011]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: cgroup: real meaning of memory.usage_in_bytes
On Fri 18-03-11 16:25:32, Michal Hocko wrote:
> because since then we are charging in bulks so we can end up with
> rss+cache <= usage_in_bytes. Simple (attached) program will

And I forgot to attach the test case

--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
#include <stdio.h>
#include <sys/mman.h>

#define PAGE_SIZE 4096U
int main()
{
int ch;
void *addr, *start;
size_t size = 1*PAGE_SIZE;

printf("I am %d\n", getpid());
printf("Add me to the cgroup tasks if you want me to be per cgroup\n");
read(0, &ch, 1);

if ((addr = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0)) == MAP_FAILED) {
perror("mmap");
return 1;
}

printf("Paging in %u pages\n", size/PAGE_SIZE);
for (start = addr ; addr < start + size; addr += PAGE_SIZE) {
*(unsigned char*)addr = 1;
}

printf("Press enter to finish\n");
read(0, &ch, 1);
return 0;
}
\
 
 \ /
  Last update: 2011-03-18 16:31    [W:0.054 / U:0.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site