[Devel] [PATCH rh7 0/9] kmemcg: switch to whitelist policy

Vladimir Davydov vdavydov at virtuozzo.com
Tue Apr 26 07:08:35 PDT 2016


Currently, all kmalloc/vmalloc allocations are accounted by default. To
exclude a particular allocation site, one need to pass __GFP_NOACCOUNT.
Such a policy turns out to be fragile, because there are tons of kmem
allocations that are intentionally shared among different cgroups. It'd
be tedious to try to identify them all and mark as __GFP_NOACCOUNT, so
let's instead switch to the whitelist policy, i.e. to charge kmalloc to
memcg one needs to explicitly pass __GFP_ACCOUNT. This is how it works
both in PCS6 and upstream BTW.

Patches 1-5 revert changes regarding the blacklist policy. Patches 6-8
are ported from mainstream. They introduce __GFP_ACCOUNT and
SLAB_ACCOUNT flags and mark those allocations that should obviously be
accounted as such. In addition, patch 9 marks all allocations that we
account in PCS6.

https://jira.sw.ru/browse/PSBM-45975

Vladimir Davydov (9):
  Revert "ve/radix-tree: do not account radix_tree_nodes to memcg"
  Revert "mm/vmalloc: do not account vmap_area to memcg"
  Partially revert "tcp: Charge socket buffers into cg memory"
  Revert "ms/sysfs: do not account sysfs_ino_ida allocations to memcg"
  Revert "ms/gfp: add __GFP_NOACCOUNT"
  memcg: only account kmem allocations marked as __GFP_ACCOUNT
  slab: add SLAB_ACCOUNT flag
  kmemcg: account certain kmem allocations to memcg
  Charge kmem allocations accounted to UBC in PCS6 to memcg

 arch/powerpc/platforms/cell/spufs/inode.c |  2 +-
 arch/x86/kernel/ldt.c                     | 10 +++++++---
 drivers/tty/tty_io.c                      |  4 ++--
 fs/9p/v9fs.c                              |  2 +-
 fs/adfs/super.c                           |  2 +-
 fs/affs/super.c                           |  2 +-
 fs/afs/super.c                            |  2 +-
 fs/befs/linuxvfs.c                        |  2 +-
 fs/bfs/inode.c                            |  2 +-
 fs/block_dev.c                            |  2 +-
 fs/btrfs/inode.c                          |  3 ++-
 fs/ceph/super.c                           |  4 ++--
 fs/cifs/cifsfs.c                          |  2 +-
 fs/coda/inode.c                           |  6 +++---
 fs/dcache.c                               |  4 ++--
 fs/ecryptfs/main.c                        |  6 ++++--
 fs/efs/super.c                            |  6 +++---
 fs/exofs/super.c                          |  4 ++--
 fs/ext2/super.c                           |  2 +-
 fs/ext4/super.c                           |  2 +-
 fs/f2fs/super.c                           |  5 +++--
 fs/fat/inode.c                            |  2 +-
 fs/fcntl.c                                |  2 +-
 fs/file.c                                 |  6 +++---
 fs/fuse/inode.c                           |  4 ++--
 fs/gfs2/main.c                            |  3 ++-
 fs/hfs/super.c                            |  4 ++--
 fs/hfsplus/super.c                        |  2 +-
 fs/hostfs/hostfs_kern.c                   |  2 +-
 fs/hpfs/super.c                           |  2 +-
 fs/hugetlbfs/inode.c                      |  2 +-
 fs/inode.c                                |  2 +-
 fs/isofs/inode.c                          |  2 +-
 fs/jffs2/super.c                          |  2 +-
 fs/jfs/super.c                            |  2 +-
 fs/locks.c                                |  2 +-
 fs/logfs/inode.c                          |  3 ++-
 fs/minix/inode.c                          |  2 +-
 fs/namespace.c                            |  4 ++--
 fs/ncpfs/inode.c                          |  2 +-
 fs/nfs/inode.c                            |  2 +-
 fs/nfsd/vfs.c                             |  2 +-
 fs/nilfs2/super.c                         |  3 ++-
 fs/ntfs/super.c                           |  4 ++--
 fs/ocfs2/dlmfs/dlmfs.c                    |  2 +-
 fs/ocfs2/super.c                          |  2 +-
 fs/openpromfs/inode.c                     |  2 +-
 fs/pipe.c                                 |  2 +-
 fs/proc/inode.c                           |  3 ++-
 fs/qnx4/inode.c                           |  2 +-
 fs/qnx6/inode.c                           |  2 +-
 fs/reiserfs/super.c                       |  3 ++-
 fs/romfs/super.c                          |  4 ++--
 fs/select.c                               |  4 ++--
 fs/seq_file.c                             | 10 +++++-----
 fs/squashfs/super.c                       |  3 ++-
 fs/sysfs/dir.c                            |  2 +-
 fs/sysv/inode.c                           |  2 +-
 fs/ubifs/super.c                          |  4 ++--
 fs/udf/super.c                            |  3 ++-
 fs/ufs/super.c                            |  2 +-
 fs/xfs/kmem.h                             |  1 +
 fs/xfs/xfs_super.c                        |  4 ++--
 include/linux/gfp.h                       |  5 +++--
 include/linux/memcontrol.h                |  6 ++----
 include/linux/slab.h                      |  5 +++++
 include/linux/thread_info.h               |  5 +++--
 ipc/mqueue.c                              |  2 +-
 ipc/msgutil.c                             |  4 ++--
 ipc/sem.c                                 |  6 +++---
 ipc/util.c                                |  4 ++--
 kernel/cred.c                             |  4 ++--
 kernel/delayacct.c                        |  2 +-
 kernel/fairsched.c                        |  3 ++-
 kernel/fork.c                             | 22 +++++++++++++---------
 kernel/pid.c                              |  2 +-
 kernel/posix-timers.c                     |  2 +-
 lib/radix-tree.c                          |  6 ++----
 mm/kmemleak.c                             |  3 +--
 mm/memcontrol.c                           |  6 ++++++
 mm/nommu.c                                |  2 +-
 mm/page_alloc.c                           |  3 ++-
 mm/rmap.c                                 |  6 ++++--
 mm/shmem.c                                |  2 +-
 mm/slab.h                                 |  5 +++--
 mm/slub.c                                 |  4 +++-
 mm/vmalloc.c                              |  2 +-
 net/8021q/vlan.c                          |  2 +-
 net/core/dev.c                            | 10 +++++-----
 net/core/fib_rules.c                      |  4 ++--
 net/core/filter.c                         |  2 +-
 net/core/scm.c                            |  4 ++--
 net/core/sock.c                           |  6 +++---
 net/ipv4/devinet.c                        |  2 +-
 net/ipv4/fib_trie.c                       |  4 ++--
 net/ipv4/netfilter/ip_tables.c            | 11 ++++++++---
 net/ipv4/tcp.c                            |  7 +------
 net/ipv4/tcp_input.c                      |  2 +-
 net/ipv4/tcp_output.c                     |  6 +++---
 net/ipv6/addrconf.c                       |  2 +-
 net/ipv6/ip6_fib.c                        |  2 +-
 net/ipv6/route.c                          |  2 +-
 net/netfilter/ipvs/ip_vs_conn.c           |  2 +-
 net/netfilter/nf_conntrack_core.c         |  7 +++++--
 net/netfilter/x_tables.c                  |  4 ++--
 net/packet/af_packet.c                    | 21 +++++++++++----------
 net/socket.c                              |  2 +-
 net/sunrpc/rpc_pipe.c                     |  2 +-
 108 files changed, 223 insertions(+), 184 deletions(-)

-- 
2.1.4



More information about the Devel mailing list