memcg-disable-kmem-charging-in-nmi-for-unsupported-arch.patch removed from -mm tree
The quilt patch titled
Subject: memcg: disable kmem charging in nmi for unsupported arch
has been removed from the -mm tree. Its filename was
memcg-disable-kmem-charging-in-nmi-for-unsupported-arch.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Shakeel Butt <[email protected]>
Subject: memcg: disable kmem charging in nmi for unsupported arch
Date: Sun, 18 May 2025 23:31:38 -0700
Patch series "memcg: nmi-safe kmem charging", v4.
Users can attached their BPF programs at arbitrary execution points in the kernel and such BPF programs may run in nmi context. In addition, these programs can trigger memcg charged kernel allocations in the nmi context. However memcg charging infra for kernel memory is not equipped to handle nmi context for all architectures.
This series removes the hurdles to enable kmem charging in the nmi context for most of the archs. For archs without CONFIG_HAVE_NMI, this series is a noop. For archs with NMI support and have CONFIG_ARCH_HAS_NMI_SAFE_THIS_CPU_OPS, the previous work to make memcg stats re-entrant is sufficient for allowing kmem charging in nmi context. For archs with NMI support but without CONFIG_ARCH_HAS_NMI_SAFE_THIS_CPU_OPS and with ARCH_HAVE_NMI_SAFE_CMPXCHG, this series added infra to support kmem charging in nmi context. Lastly those archs with NMI support but without CONFIG_ARCH_HAS_NMI_SAFE_THIS_CPU_OPS and ARCH_HAVE_NMI_SAFE_CMPXCHG, kmem charging in nmi context is not supported at all.
Mostly used archs have support for CONFIG_ARCH_HAS_NMI_SAFE_THIS_CPU_OPS and this series should be almost a noop (other than making memcg_rstat_updated nmi safe) for such archs.
This patch (of 5):
The memcg accounting and stats uses this_cpu* and atomic* ops. There are archs which define CONFIG_HAVE_NMI but does not define CONFIG_ARCH_HAS_NMI_SAFE_THIS_CPU_OPS and ARCH_HAVE_NMI_SAFE_CMPXCHG, so memcg accounting for such archs in nmi context is not possible to support. Let's just disable memcg accounting in nmi context for such archs.
---
init/Kconfig | 7 +++++++ mm/memcontrol.c | 3 +++ 2 files changed, 10 insertions(+)
init/Kconfig renamed from init/Kconfig~memcg-disable-kmem-charging-in-nmi-for-unsupported-arch +7 -0
@@ -1006,6 +1006,13 @@ config MEMCG help Provides control over the memory footprint of tasks in a cgroup. +config MEMCG_NMI_UNSAFE + bool + depends on MEMCG + depends on HAVE_NMI + depends on !ARCH_HAS_NMI_SAFE_THIS_CPU_OPS && !ARCH_HAVE_NMI_SAFE_CMPXCHG + default y + config MEMCG_V1 bool "Legacy cgroup v1 memory controller" depends on MEMCG
mm/memcontrol.c renamed from mm/memcontrol.c~memcg-disable-kmem-charging-in-nmi-for-unsupported-arch +3 -0
@@ -2650,6 +2650,9 @@ __always_inline struct obj_cgroup *currestruct mem_cgroup *memcg;struct obj_cgroup *objcg; +if (IS_ENABLED (CONFIG_MEMCG_NMI_UNSAFE ) &&in_nmi ()) +return NULL ; +if (in_task ()) { memcg = current->active_memcg;if (unlikely (memcg))
_
Patches currently in -mm which might be from [email protected] are