mm-vmstat-fix-build-with-memcg=y-and-vm_event_counters=n.patch removed from -mm tree
The quilt patch titled
Subject: mm/vmstat: make MEMCG select VM_EVENT_COUNTERS
has been removed from the -mm tree. Its filename was
mm-vmstat-fix-build-with-memcg=y-and-vm_event_counters=n.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: "Kirill A. Shutemov" <[email protected]>
Subject: mm/vmstat: make MEMCG select VM_EVENT_COUNTERS
Date: Wed, 4 Jun 2025 12:51:11 +0300
The vmstat_text array contains labels for counters displayed in /proc/vmstat. It is important to keep the labels in sync with the counters.
There is a BUILD_BUG_ON() check in vmstat_start() that ensures the size of the vmstat_text is not smaller than VM_EVENT_COUNTERS. This helps to catch cases where a new counter is added but the label is not. However, it does not help if a counter is removed but the label remains.
It would be nice to make the BUILD_BUG_ON() check more strict to catch such cases. However, when compiling with MEMCG enabled but VM_EVENT_COUNTERS disabled, the vmstat_text array is larger than NR_VMSTAT_ITEMS.
This issue arises because some elements of the vmstat_text array are present when either MEMCG or VM_EVENT_COUNTERS is enabled, but NR_VMSTAT_ITEMS only accounts for these elements if VM_EVENT_COUNTERS is enabled.
Instead of adjusting the NR_VMSTAT_ITEMS definition to account for MEMCG, make MEMCG select VM_EVENT_COUNTERS. VM_EVENT_COUNTERS is enabled in most configurations anyway.
---
include/linux/vmstat.h | 4 ++-- init/Kconfig | 1 + mm/vmstat.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-)
include/linux/vmstat.h renamed from include/linux/vmstat.h~mm-vmstat-fix-build-with-memcg=y-and-vm_event_counters=n +2 -2
@@ -507,7 +507,7 @@ static inline const char *lru_list_name(return node_stat_name (NR_LRU_BASE + lru) +3 ;// skip "nr_" } -#if defined(CONFIG_VM_EVENT_COUNTERS ) || defined(CONFIG_MEMCG ) +#if defined(CONFIG_VM_EVENT_COUNTERS )static inline const char *vm_event_name (enum vm_event_item item) { return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
@@ -516,7 +516,7 @@ static inline const char *vm_event_name(NR_VM_STAT_ITEMS + item]; } -#endif /* CONFIG_VM_EVENT_COUNTERS || CONFIG_MEMCG */ +#endif /* CONFIG_VM_EVENT_COUNTERS */ #ifdef CONFIG_MEMCG
init/Kconfig renamed from init/Kconfig~mm-vmstat-fix-build-with-memcg=y-and-vm_event_counters=n +1 -0
@@ -992,6 +992,7 @@ config MEMCG select PAGE_COUNTER select EVENTFD select SLAB_OBJ_EXT + select VM_EVENT_COUNTERS help Provides control over the memory footprint of tasks in a cgroup.
mm/vmstat.c renamed from mm/vmstat.c~mm-vmstat-fix-build-with-memcg=y-and-vm_event_counters=n +2 -2
@@ -1287,7 +1287,7 @@ const char * const vmstat_text[] = { "nr_memmap_pages", "nr_memmap_boot_pages", -#if defined(CONFIG_VM_EVENT_COUNTERS ) || defined(CONFIG_MEMCG ) +#if defined(CONFIG_VM_EVENT_COUNTERS )/* enum vm_event_item counters */ "pgpgin" , "pgpgout",
@@ -1475,7 +1475,7 @@ const char * const vmstat_text[] = { "kstack_rest",#endif #endif -#endif /* CONFIG_VM_EVENT_COUNTERS || CONFIG_MEMCG */ +#endif /* CONFIG_VM_EVENT_COUNTERS */ };#endif /* CONFIG_PROC_FS || CONFIG_SYSFS || CONFIG_NUMA || CONFIG_MEMCG */
_
Patches currently in -mm which might be from [email protected] are