Re: [PATCH RFC] mm/kmemleak: avoid soft lockup when scanning task stacks

From: Breno Leitao

Date: Fri Jun 12 2026 - 06:39:48 EST


On Fri, Jun 12, 2026 at 05:57:12PM +0800, Lance Yang wrote:

> > If we go this route, the aborted round has to suppress reporting, reusing
> > kmemleak's existing "scan was interrupted -> don't report" path:
> >
> > if (need_resched() && !kmemleak_stack_scan_break(g, p)) {
> > aborted = true;
> > goto unlock;
> > }
>
> I'd expect the normal case to just drop RCU, cond_resched(), take RCU
> again, see both cursors still alive, and keep walking :)
>
> > ...
> > if (scan_should_stop() || aborted)
> > return;
>
> And yeah, you're right. If we do lost a cursor, bailing out and
> skipping reporting fot that incomplete root scan should be the
> right thing, I guess :D

Thanks! Under what circumstances would the cursor actually be lost?