Bug 679021

Summary: semantic difference between mapped file counters of memcg and global VM
Product: Red Hat Enterprise Linux 6 Reporter: Johannes Weiner <jweiner>
Component: kernelAssignee: Johannes Weiner <jweiner>
Status: CLOSED ERRATA QA Contact: Boris Ranto <branto>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.0CC: branto, lwang, mzywusko
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kernel-2.6.32-121.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 12:43:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Johannes Weiner 2011-02-21 10:16:06 UTC
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;
}

Comment 2 RHEL Program Management 2011-03-01 21:40:01 UTC
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.

Comment 3 Aristeu Rozanski 2011-03-10 17:57:41 UTC
Patch(es) available on kernel-2.6.32-121.el6

Comment 8 errata-xmlrpc 2011-05-19 12:43:40 UTC
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