Bug 679021 - semantic difference between mapped file counters of memcg and global VM
Summary: semantic difference between mapped file counters of memcg and global VM
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: kernel
Version: 6.0
Hardware: All
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Johannes Weiner
QA Contact: Boris Ranto
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-02-21 10:16 UTC by Johannes Weiner
Modified: 2015-09-01 03:50 UTC (History)
3 users (show)

Fixed In Version: kernel-2.6.32-121.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-19 12:43:40 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0542 0 normal SHIPPED_LIVE Important: Red Hat Enterprise Linux 6.1 kernel security, bug fix and enhancement update 2011-05-19 11:58:07 UTC

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


Note You need to log in before you can comment on or make changes to this bug.