On Tue, Nov 14, 2017 at 05:24:29PM +0000, Roman Gushchin wrote: > This patch implements basic accounting of memory consumption > by hugetlbfs pages for cgroup v2 memory controller. > > Cgroup v2 memory controller lacks any visibility into the > hugetlbfs memory consumption. Cgroup v1 implemented a separate > hugetlbfs controller, which provided such stats, and also > provided some control abilities. Although porting of the > hugetlbfs controller to cgroup v2 is arguable a good idea and > is outside of scope of this patch, it's very useful to have > basic stats provided by memory.stat. > > As hugetlbfs memory can easily represent a big portion of total > memory, it's important to understand who (which memcg/container) > is using it. > > The number is represented in memory.stat as "hugetlb" in bytes and > is printed unconditionally. Accounting code doesn't depend on > cgroup v1 hugetlb controller. > > Example: > $ cat /sys/fs/cgroup/user.slice/user-0.slice/session-1.scope/memory.stat > anon 1634304 > file 1163264 > kernel_stack 16384 > slab 737280 > sock 0 > shmem 0 > file_mapped 32768 > file_dirty 4096 > file_writeback 0 > inactive_anon 0 > active_anon 1634304 > inactive_file 65536 > active_file 1097728 > unevictable 0 > slab_reclaimable 282624 > slab_unreclaimable 454656 > hugetlb 1073741824 > pgfault 4580 > pgmajfault 13 > ... > > Signed-off-by: Roman Gushchin <[email protected]> > Cc: Johannes Weiner <[email protected]> > Cc: Michal Hocko <[email protected]> > Cc: Vladimir Davydov <[email protected]> > Cc: Andrew Morton <[email protected]> > Cc: Tejun Heo <[email protected]> > Cc: Mike Kravetz <[email protected]> > Cc: Dave Hansen <[email protected]> > Cc: [email protected] > Cc: [email protected] > Cc: [email protected] > Cc: [email protected]
Acked-by: Tejun Heo <[email protected]> Thanks. -- tejun

