diff options
| author | Breno Leitao <leitao@debian.org> | 2026-09-21 05:30:27 -0700 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-10-12 21:26:39 -0700 |
| commit | 213753c71e098a5bca7866a147bfd262cf9d347c (patch) | |
| tree | 9976354e5dac44d8503e297300479293bfd3d220 /tools/perf/scripts/python/export-to-sqlite.py | |
| parent | 1b4bbae111f13f01732c04a6663af209772e259a (diff) | |
mm: kmemleak: scan the struct page array in MAX_SCAN_SIZE batches
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 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.
This can make the scan faster. On an arm64 VM with 24 GiB and ~17 GiB
in use, the struct page phase goes from 4390k scan_block() calls down
to 69k for the same 4390k pages scanned, and the whole scan about 20%
faster (on debug kernel). The win is in the per-acquisition cost, so on
a kernel built without the lock debugging options the scan time is
unchanged. I don't think it will be a problem doing more on
scan_block(), given we have the scan_should_stop() protection.
Coverage is unchanged: a temporary assertion comparing the number of
eligible pages against the number actually passed to scan_block()
matched on every zone of every scan, including while memory was being
freed underneath the scan.
Link: https://lore.kernel.org/20260921-b4-kmemleak-page-scan-v1-2-fb97d4801b3a@debian.org
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions
