Red Hat Bugzilla – Bug 679021
semantic difference between mapped file counters of memcg and global VM
Last modified: 2015-08-31 23:50:48 EDT
Description of problem: The global nr_mapped count in /proc/vmstat represents all mapped file pages, whereas mapped_file in /cgroup/memory/memory.stat does not include shmem pages. How reproducible: The counters differ by the number of shmem pages, so creating those makes the problem visible. Steps to Reproduce: compare the counters before and after creating a few thousand shmem pages # cat /cgroup/memory/memory.stat /proc/vmstat | awk '/^mapped_file/ { print($2 / 4096); } /^nr_mapped/ { print $2 }' # ./mkshmem & # !-2 Actual results: The counters differ by roughly the number of shmem pages mkshmem created. Expected results: The counters should be roughly the same. Additional info: /* gcc -o mkshmem mkshmem.c */ #include <sys/mman.h> #include <string.h> #include <stdio.h> #define SIZE (20UL << 20) int main(void) { char *map; map = mmap(NULL, SIZE, PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0); if (map == MAP_FAILED) return 1; memset(map, 0, SIZE); getchar(); munmap(map, SIZE); return 0; }
This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux maintenance release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux Update release for currently deployed products. This request is not yet committed for inclusion in an Update release.
Patch(es) available on kernel-2.6.32-121.el6
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2011-0542.html