[PATCH 0/2] mm: kmemleak: avoid long RCU read-side sections in reports

From: Weilin Tong

Date: Thu Nov 05 2026 - 04:59:09 EST


Reading a kmemleak report can traverse all tracked objects in one
RCU read-side section and cause a stall.

Serialize disable-time cleanup with clear operations and report readers,
then use kmemleak_cond_resched() in both report traversal loops to let RCU
progress safely during long reads.

QEMU/KVM tests on mm-stable 6628e7d4c6b25:
* With 134 million real allocations and no injected delay, continuous
RCU sections fell from 23.11-23.38 s to 126-972 us. Total reading took
23.11-23.38 s before and 23.67-24.09 s after. Neither kernel stalled.
* With identical 300 us per-node delays, only kernels without patch 2
stalled. Patch 1 eliminated overlapping cleanup entry.
* Under lazy/full preemption, 560 concurrent-removal cases, 20 deleted-chain
cases and debugfs read checks passed with KASAN, lockdep and DEBUG_LIST.

Weilin Tong (2):
mm: kmemleak: serialize disable-time cleanup
mm: kmemleak: reschedule while reading reports

mm/kmemleak.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)


base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4