* + mm-kmemleak-serialize-disable-time-cleanup.patch added to mm-new branch
@ 2026-11-11 23:02 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-11-11 23:02 UTC (permalink / raw)
To: mm-commits, catalin.marinas, tongweilin, akpm
The patch titled
Subject: mm: kmemleak: serialize disable-time cleanup
has been added to the -mm mm-new branch. Its filename is
mm-kmemleak-serialize-disable-time-cleanup.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-kmemleak-serialize-disable-time-cleanup.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Weilin Tong <tongweilin@linux.alibaba.com>
Subject: mm: kmemleak: serialize disable-time cleanup
Date: Thu, 5 Nov 2026 17:52:49 +0800
kmemleak_do_cleanup() drops scan_mutex before removing tracked objects
without kmemleak_lock. A concurrent clear command can therefore start
another cleanup while the background cleanup is still running.
Keep scan_mutex held until the background cleanup completes, serializing
its lockless removals with explicit clearing and report readers.
Link: https://lore.kernel.org/149d93f2cfe20d355f4d9882ce2bf99030217772.1793871596.git.tongweilin@linux.alibaba.com
Fixes: 2abd839aa7e6 ("kmemleak: Do not corrupt the object_list during clean-up")
Signed-off-by: Weilin Tong <tongweilin@linux.alibaba.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
---
mm/kmemleak.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/mm/kmemleak.c~mm-kmemleak-serialize-disable-time-cleanup
+++ a/mm/kmemleak.c
@@ -2532,12 +2532,13 @@ static void kmemleak_do_cleanup(struct w
* function.
*/
kmemleak_free_enabled = 0;
- mutex_unlock(&scan_mutex);
+ /* Serialize the lockless cleanup with report readers. */
if (!kmemleak_found_leaks)
__kmemleak_do_cleanup();
else
pr_info("Kmemleak disabled without freeing internal data. Reclaim the memory with \"echo clear > /sys/kernel/debug/kmemleak\".\n");
+ mutex_unlock(&scan_mutex);
}
static DECLARE_WORK(cleanup_work, kmemleak_do_cleanup);
_
Patches currently in -mm which might be from tongweilin@linux.alibaba.com are
tools-mm-thpmaps-fix-partial-thp-anon-file-accounting.patch
tools-mm-thpmaps-fix-missing-order-1-file-thp-statistics.patch
tools-mm-thpmaps-fix-missing-mapping-names.patch
mm-kmemleak-serialize-disable-time-cleanup.patch
tools-mm-thpmaps-handle-carriage-returns-and-non-utf-8-filenames.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-11 23:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-11 23:02 + mm-kmemleak-serialize-disable-time-cleanup.patch added to mm-new branch 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.