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