]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
kmemcg: account certain kmem allocations to memcg
authorVladimir Davydov <vdavydov@virtuozzo.com>
Thu, 14 Jan 2016 23:18:21 +0000 (15:18 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Jan 2016 00:00:49 +0000 (16:00 -0800)
commit5d097056c9a017a3b720849efb5432f37acabbac
treee960a2513a789101097e97cfda27b247ef8650eb
parent37f08dda29dac8a595999b8d3eaa9bf0f763dd9d
kmemcg: account certain kmem allocations to memcg

Mark those kmem allocations that are known to be easily triggered from
userspace as __GFP_ACCOUNT/SLAB_ACCOUNT, which makes them accounted to
memcg.  For the list, see below:

 - threadinfo
 - task_struct
 - task_delay_info
 - pid
 - cred
 - mm_struct
 - vm_area_struct and vm_region (nommu)
 - anon_vma and anon_vma_chain
 - signal_struct
 - sighand_struct
 - fs_struct
 - files_struct
 - fdtable and fdtable->full_fds_bits
 - dentry and external_name
 - inode for all filesystems. This is the most tedious part, because
   most filesystems overwrite the alloc_inode method.

The list is far from complete, so feel free to add more objects.
Nevertheless, it should be close to "account everything" approach and
keep most workloads within bounds.  Malevolent users will be able to
breach the limit, but this was possible even with the former "account
everything" approach (simply because it did not account everything in
fact).

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Greg Thelen <gthelen@google.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
65 files changed:
arch/powerpc/platforms/cell/spufs/inode.c
drivers/staging/lustre/lustre/llite/super25.c
fs/9p/v9fs.c
fs/adfs/super.c
fs/affs/super.c
fs/afs/super.c
fs/befs/linuxvfs.c
fs/bfs/inode.c
fs/block_dev.c
fs/btrfs/inode.c
fs/ceph/super.c
fs/cifs/cifsfs.c
fs/coda/inode.c
fs/dcache.c
fs/ecryptfs/main.c
fs/efs/super.c
fs/exofs/super.c
fs/ext2/super.c
fs/ext4/super.c
fs/f2fs/super.c
fs/fat/inode.c
fs/file.c
fs/fuse/inode.c
fs/gfs2/main.c
fs/hfs/super.c
fs/hfsplus/super.c
fs/hostfs/hostfs_kern.c
fs/hpfs/super.c
fs/hugetlbfs/inode.c
fs/inode.c
fs/isofs/inode.c
fs/jffs2/super.c
fs/jfs/super.c
fs/logfs/inode.c
fs/minix/inode.c
fs/ncpfs/inode.c
fs/nfs/inode.c
fs/nilfs2/super.c
fs/ntfs/super.c
fs/ocfs2/dlmfs/dlmfs.c
fs/ocfs2/super.c
fs/openpromfs/inode.c
fs/proc/inode.c
fs/qnx4/inode.c
fs/qnx6/inode.c
fs/reiserfs/super.c
fs/romfs/super.c
fs/squashfs/super.c
fs/sysv/inode.c
fs/ubifs/super.c
fs/udf/super.c
fs/ufs/super.c
fs/xfs/kmem.h
fs/xfs/xfs_super.c
include/linux/thread_info.h
ipc/mqueue.c
kernel/cred.c
kernel/delayacct.c
kernel/fork.c
kernel/pid.c
mm/nommu.c
mm/rmap.c
mm/shmem.c
net/socket.c
net/sunrpc/rpc_pipe.c