mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gregory Price <gourry@gourry.net>
To: liuqiqi@kylinos.cn
Cc: akpm@linux-foundation.org, vbabka@kernel.org, surenb@google.com,
	 mhocko@suse.com, brendan.jackman@linux.dev, hannes@cmpxchg.org,
	ziy@nvidia.com,  linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: page_alloc: add trace_mm_page_alloc to bulk allocation path
Date: Mon, 7 Sep 2026 10:53:19 -0400	[thread overview]
Message-ID: <ap7Pbm70m0pw_NqM@gourry-fedora-PF4VCD3F> (raw)
In-Reply-To: <20260907120949.418450-1-liuqiqi@kylinos.cn>

On Mon, Sep 07, 2026 at 08:09:49PM +0800, liuqiqi@kylinos.cn wrote:
> From: Qiqi Liu <liuqiqi@kylinos.cn>
> 
> The bulk allocation path in alloc_pages_bulk_noprof() does not fire
> trace_mm_page_alloc for each allocated page, leaving bulk-allocated
> pages invisible to ftrace, BPF, and perf. Only the fallback path via
> __alloc_frozen_pages_noprof() is traced.
> 
> Add trace_mm_page_alloc() after set_page_refcounted() in the bulk loop
> to match the standard allocation path. The tracepoint is gated by
> static key, so there is no overhead when tracing is disabled.
> 
> Signed-off-by: Qiqi Liu <liuqiqi@kylinos.cn>
> ---
>  mm/page_alloc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 12fac9084c48..d17c21775cb2 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5280,6 +5280,7 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
>  
>  		prep_new_page(page, 0, gfp, ALLOC_DEFAULT);
>  		set_page_refcounted(page);
> +		trace_mm_page_alloc(page, 0, gfp, ac.migratetype);

Sashiko asked whether we're also missing kmsan hook here as well:

	kmsan_alloc_page(page, 0, gfp);

Might be worth a quick look and just adding both in one go.

~Gregory


  reply	other threads:[~2026-09-07 14:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 12:09 liuqiqi
2026-09-07 14:53 ` Gregory Price [this message]
2026-09-08  9:56   ` Qiqi Liu
2026-09-08  3:19 ` [PATCH v2] mm: page_alloc: add missing hooks " Qiqi Liu
2026-09-08  6:50 ` [PATCH v3] " Qiqi Liu
2026-09-08  8:38   ` Vlastimil Babka (SUSE)
2026-09-08 10:04     ` Qiqi Liu
2026-09-08 10:23 ` [PATCH v4] " Qiqi Liu
2026-09-08 12:23   ` Vlastimil Babka (SUSE)
2026-09-08 15:08   ` Gregory Price
2026-09-09  2:20   ` Zi Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ap7Pbm70m0pw_NqM@gourry-fedora-PF4VCD3F \
    --to=gourry@gourry.net \
    --cc=akpm@linux-foundation.org \
    --cc=brendan.jackman@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuqiqi@kylinos.cn \
    --cc=mhocko@suse.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®