This patchset adds percpu memory accounting to memory cgroups. It's based on the rework of the slab controller and reuses concepts and features introduced for the per-object slab accounting. Percpu allocations by their nature are scattered over multiple pages, so they can't be tracked on the per-page basis. So the per-object tracking introduced by the new slab controller is reused. The patchset implements charging of percpu allocations, adds memcg-level statistics, enables accounting for memcg internals perpcu allocations and provides some basic tests. It's based on top of the current version of the new slab controller patchset. The following patches are actually required by this series: mm: memcg: factor out memcg- and lruvec-level changes out of __mod_lruvec_state() mm: memcg: prepare for byte-sized vmstat items mm: memcg: convert vmstat slab counters to bytes mm: slub: implement SLUB version of obj_to_index() mm: memcontrol: decouple reference counting from page accounting mm: memcg/slab: obj_cgroup API The whole series can be found here: https://github.com/rgushchin/linux/pull/new/percpu_acc.RFC Roman Gushchin (5): percpu: return number of released bytes from pcpu_free_area() mm: memcg/percpu: account percpu memory to memory cgroups mm: memcg/percpu: per-memcg percpu memory statistics mm: memcg: charge memcg percpu memory to the parent cgroup kselftests: cgroup: add perpcu memory accounting test Documentation/admin-guide/cgroup-v2.rst | 4 + include/linux/memcontrol.h | 8 + mm/memcontrol.c | 18 +- mm/percpu-internal.h | 49 ++++- mm/percpu-km.c | 5 +- mm/percpu-stats.c | 36 ++-- mm/percpu-vm.c | 5 +- mm/percpu.c | 206 ++++++++++++++++++--- tools/testing/selftests/cgroup/test_kmem.c | 59 ++++++ 9 files changed, 341 insertions(+), 49 deletions(-) -- 2.25.4