Re: [PATCH 0/2] mm: kmemleak: avoid long RCU read-side sections in reports
From: Andrew Morton
Date: Tue Nov 10 2026 - 00:20:46 EST
On Thu, 5 Nov 2026 17:52:48 +0800 Weilin Tong <tongweilin@xxxxxxxxxxxxxxxxx> wrote:
> 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.
Thanks. Has this been demonstrated? Are there real-world reports? Or
is this a theoretical thing from (LLM assisted) code inspection?
Please do share such details, they matter.
In [2/2], *pos does not advance while kmemleak_seq_next() skips objects
whose get_object() fails. If *pos isn't aligned to the 256 boundary
and preemption clears need_resched(), a long deleted chain gets no
periodic RCU break. Seems the code could tighten and simplify the "once
per 256 operations" logic?