Thread (11 messages) 11 messages, 4 authors, 21d ago

Re: [PATCH v4] mm: page_alloc: add missing hooks to bulk allocation path

From: "Zi Yan" <ziy@nvidia.com>
Date: 2026-09-09 02:20:13
Also in: lkml

On Tue Sep 8, 2026 at 6:23 AM EDT, Qiqi Liu wrote:
The bulk allocation path in alloc_pages_bulk_noprof() currently misses
trace_mm_page_alloc() and kmsan_alloc_page() calls, leaving bulk-allocated
pages invisible to ftrace/BPF/perf and leaving KMSAN shadow memory stale.

Add both calls in the bulk loop to match the standard allocation path,
placing them before set_page_refcounted() for consistency. The gfp mask
passed to kmsan_alloc_page() is stripped of __GFP_RECLAIM because the
bulk loop runs under the PCP spinlock, and KMSAN's stack depot allocation
must not sleep.

Both are no-ops when their respective features are disabled, so there
is no overhead in production kernels.

Suggested-by: Gregory Price <gourry@gourry.net>
Signed-off-by: Qiqi Liu <redacted>
---
 mm/page_alloc.c | 2 ++
 1 file changed, 2 insertions(+)
LGTM.

Reviewed-by: Zi Yan <ziy@nvidia.com>

BTW, please send new versions in a new thread instead of replying to the
old one. Thanks.

-- 
Best Regards,
Yan, Zi

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help