Skip to contentSkip to conversation

memcg-nmi-safe-memcg-stats-for-specific-archs.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jun 1, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: memcg: nmi safe memcg stats for specific archs
has been removed from the -mm tree. Its filename was
memcg-nmi-safe-memcg-stats-for-specific-archs.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: nmi safe memcg stats for specific archs
Date: Sun, 18 May 2025 23:31:39 -0700

There are archs which have NMI but does not support this_cpu_* ops safely in the nmi context but they support safe atomic ops in nmi context. For such archs, let's add infra to use atomic ops for the memcg stats which can be updated in nmi.

At the moment, the memcg stats which get updated in the objcg charging path are MEMCG_KMEM, NR_SLAB_RECLAIMABLE_B & NR_SLAB_UNRECLAIMABLE_B. Rather than adding support for all memcg stats to be nmi safe, let's just add infra to make these three stats nmi safe which this patch is doing.

Cc Alexei Starovoitov <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Mathieu Desnoyers <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Muchun Song <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Roman Gushchin <[email protected]>
Cc Sebastian Andrzej Siewior <[email protected]>
Cc Tejun Heo <[email protected]>

---

 include/linux/memcontrol.h |   10 +++++++
 init/Kconfig               |    7 +++++
 mm/memcontrol.c            |   49 +++++++++++++++++++++++++++++++++++
 3 files changed, 66 insertions(+)
include/linux/memcontrol.h renamed from include/linux/memcontrol.h~memcg-nmi-safe-memcg-stats-for-specific-archs +10 -0
@@ -113,6 +113,12 @@ struct mem_cgroup_per_node {
 	CACHELINE_PADDING(_pad2_);
 	unsigned long		lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS];
 	struct mem_cgroup_reclaim_iter	iter;
+
+#ifdef CONFIG_MEMCG_NMI_SAFETY_REQUIRES_ATOMIC
+	/* slab stats for nmi context */
+	atomic_t		slab_reclaimable;
+	atomic_t		slab_unreclaimable;
+#endif
 };
 
 struct mem_cgroup_threshold {
@@ -236,6 +242,10 @@ struct mem_cgroup {
 	atomic_long_t		memory_events[MEMCG_NR_MEMORY_EVENTS];
 	atomic_long_t		memory_events_local[MEMCG_NR_MEMORY_EVENTS];
 
+#ifdef CONFIG_MEMCG_NMI_SAFETY_REQUIRES_ATOMIC
+	/* MEMCG_KMEM for nmi context */
+	atomic_t		kmem_stat;
+#endif
 	/*
 	 * Hint of reclaim pressure for socket memroy management. Note
 	 * that this indicator should NOT be used in legacy cgroup mode
init/Kconfig renamed from init/Kconfig~memcg-nmi-safe-memcg-stats-for-specific-archs +7 -0
@@ -1013,6 +1013,13 @@ config MEMCG_NMI_UNSAFE
 	depends on !ARCH_HAS_NMI_SAFE_THIS_CPU_OPS && !ARCH_HAVE_NMI_SAFE_CMPXCHG
 	default y
 
+config MEMCG_NMI_SAFETY_REQUIRES_ATOMIC
+	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-nmi-safe-memcg-stats-for-specific-archs +49 -0

61 lines not on this page · raw message

_

Patches currently in -mm which might be from [email protected] are