Re: [PATCH 2/2] mm: kmemleak: scan the struct page array in MAX_SCAN_SIZE batches

From: Andrew Morton

Date: Tue Sep 22 2026 - 21:39:38 EST


On Tue, 22 Sep 2026 10:51:46 +0100 Catalin Marinas <catalin.marinas@xxxxxxx> wrote:

> On Mon, Sep 21, 2026 at 05:30:27AM -0700, Breno Leitao wrote:
> > scan_zone_pages() scans the struct page array one page per scan_block()
> > call:
> >
> > if (scan_block(page, page + 1, NULL))
> >
> > scan_block() takes kmemleak_lock with interrupts disabled for the
> > duration of the call, so this acquires the lock once per online PFN to
> > scan a single struct page.
> >
> > Gather runs of adjacent eligible struct pages and pass each run to
> > scan_block() in one call, capped at MAX_SCAN_SIZE.
> >
> > The longest kmemleak_lock is now held is MAX_SCAN_SIZE worth of words,
>
> Remove an 'is'.

That was actually correct, but it doesn't read well.

> Also, MAX_SCAN_SIZE worth of bytes rather than words.

edited, thanks.

How's this?

: The longest kmemleak_lock hold duration is now MAX_SCAN_SIZE worth of
: bytes. The same bound scan_large_block() already applies to the data
: sections and the per-CPU areas.