Skip to content

mm: kmem: kernel memory accounting in an interrupt context

Roman Gushchin linux-mm lkml 1 version Applied

Status from this message: [merged] mm-kmem-enable-kernel-memcg-accounting-from-interrupt-contexts.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesApplied 4/4

Changes in v1 from the cover letter

- fixed a typo, by Shakeel

Patches in v1 All 4 applied

#Subject and filesSizeRepliesApplied
1/4mm: kmem: move memcg_kmem_bypass() calls to get_mem/obj_cgroup_from_current()mm/memcontrol.c mm/percpu.c mm/slab.h+9 -100 repliesApplied
2/4mm: kmem: remove redundant checks from get_obj_cgroup_from_current()mm/memcontrol.c+0 -30 repliesApplied
3/4mm: kmem: prepare remote memcg charging infra for interrupt contextsinclude/linux/sched/mm.h mm/memcontrol.c+45 -160 repliesApplied
4/4mm: kmem: enable kernel memcg accounting from interrupt contextsinclude/linux/memcontrol.h mm/memcontrol.c+13 -120 repliesApplied

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchShakeel Butt
1/4R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH v1 0/4] mm: kmem: kernel memory accounting in an interrupt context

This patchset implements memcg-based memory accounting of allocations made from an interrupt context.

Historically, such allocations were passed unaccounted mostly because charging the memory cgroup of the current process wasn't an option. Also performance reasons were likely a reason too.

The remote charging API allows to temporarily overwrite the currently active memory cgroup, so that all memory allocations are accounted towards some specified memory cgroup instead of the memory cgroup of the current process.

This patchset extends the remote charging API so that it can be used from an interrupt context. Then it removes the fence that prevented the accounting of allocations made from an interrupt context. It also contains a couple of optimizations/code refactorings.

This patchset doesn't directly enable accounting for any specific allocations, but prepares the code base for it. The bpf memory accounting will likely be the first user of it: a typical example is a bpf program parsing an incoming network packet, which allocates an entry in hashmap map to store some information.

v1:
- fixed a typo, by Shakeel

rfc:
https://lkml.org/lkml/2020/8/27/1155

Roman Gushchin (4):
mm: kmem: move memcg_kmem_bypass() calls to
get_mem/obj_cgroup_from_current()
mm: kmem: remove redundant checks from get_obj_cgroup_from_current()
mm: kmem: prepare remote memcg charging infra for interrupt contexts
mm: kmem: enable kernel memcg accounting from interrupt contexts

 include/linux/memcontrol.h | 12 -------
 include/linux/sched/mm.h   | 13 +++++--
 mm/memcontrol.c            | 69 ++++++++++++++++++++++++++++----------
 mm/percpu.c                |  3 +-
 mm/slab.h                  |  3 --
 5 files changed, 63 insertions(+), 37 deletions(-)
Signature · 1 line
2.26.2