* [to-be-updated] alloc_tag-skip-percpu-counter-allocation-when-profiling-is-disabled.patch removed from -mm tree
@ 2026-09-22 3:46 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-09-22 3:46 UTC (permalink / raw)
To: mm-commits, surenb, stable, sashiko-bot, kent.overstreet, hao.ge,
akpm
The quilt patch titled
Subject: alloc_tag: skip percpu counter allocation when profiling is disabled
has been removed from the -mm tree. Its filename was
alloc_tag-skip-percpu-counter-allocation-when-profiling-is-disabled.patch
This patch was dropped because an updated version will be issued
------------------------------------------------------
From: Hao Ge <hao.ge@linux.dev>
Subject: alloc_tag: skip percpu counter allocation when profiling is disabled
Date: Mon, 17 Aug 2026 14:27:25 +0800
Patch series "alloc_tag: fix a leak and a deadlock around
shutdown_mem_profiling()", v2.
Two fixes for issues reported by sashiko:
1. percpu counter leak on modules loaded after profiling is disabled.
2. AB-BA deadlock between module load and /proc/allocinfo readers.
This patch (of 2):
After shutdown_mem_profiling() clears mem_profiling_support,
needs_section_mem() returns false, so later modules have their codetag
section placed as regular data and never enter the alloc_tag maple tree.
codetag_load_module() still called load_module(), which allocated a percpu
counter for every tag; release_module_tags() could not find these modules
on unload, so the counters leaked.
Return -EOPNOTSUPP from load_module() when profiling is off:
codetag_module_init() drops the module's cmod, no counters are allocated
and the module loads without its tags. codetag_unload_module() now always
calls free_section_mem(), since a module whose module_load() returned
-EOPNOTSUPP is not in the idr but may still hold a reserved section.
Link: https://lore.kernel.org/20260817062726.106511-1-hao.ge@linux.dev
Link: https://lore.kernel.org/20260817062726.106511-2-hao.ge@linux.dev
Fixes: 4835f747d3ed ("alloc_tag: support for page allocation tag compression")
Signed-off-by: Hao Ge <hao.ge@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Sashiko <sashiko-bot@kernel.org>
Suggested-by: Suren Baghdasaryan <surenb@google.com>
Acked-by: Suren Baghdasaryan <surenb@google.com>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: <stable@vger.kernel.org>
---
lib/codetag.c | 10 ++++++++--
mm/alloc_tag.c | 4 ++++
2 files changed, 12 insertions(+), 2 deletions(-)
--- a/lib/codetag.c~alloc_tag-skip-percpu-counter-allocation-when-profiling-is-disabled
+++ a/lib/codetag.c
@@ -240,7 +240,9 @@ static int codetag_module_init(struct co
if (err < 0) {
kfree(cmod);
- return err;
+ /* -EOPNOTSUPP means we can load the module without its tag. */
+ if (err != -EOPNOTSUPP)
+ return err;
}
return 0;
@@ -388,7 +390,11 @@ void codetag_unload_module(struct module
++cttype->content_id;
}
up_write(&cttype->mod_lock);
- if (found && cttype->desc.free_section_mem)
+ /*
+ * A module whose module_load() returned -EOPNOTSUPP is not
+ * in the idr but may still hold reserved section memory.
+ */
+ if (cttype->desc.free_section_mem)
cttype->desc.free_section_mem(mod, true);
}
mutex_unlock(&codetag_lock);
--- a/mm/alloc_tag.c~alloc_tag-skip-percpu-counter-allocation-when-profiling-is-disabled
+++ a/mm/alloc_tag.c
@@ -975,6 +975,10 @@ static int load_module(struct module *mo
struct alloc_tag *stop_tag;
struct alloc_tag *tag;
+ /* Profiling disabled: load the module without its tags. */
+ if (!mem_profiling_support)
+ return -EOPNOTSUPP;
+
/* percpu counters for core allocations are already statically allocated */
if (!mod)
return 0;
_
Patches currently in -mm which might be from hao.ge@linux.dev are
module-fix-lost-error-code-from-codetag_load_module.patch
alloc_tag-remove-proc-allocinfo-outside-of-mod_lock.patch
mm-alloc_tag-account-for-reserved-tag-ids-in-the-kernel-tag-check.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-22 3:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-22 3:46 [to-be-updated] alloc_tag-skip-percpu-counter-allocation-when-profiling-is-disabled.patch removed from -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.