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; }