Re: [PATCH v2] mm/page_alloc: trace PCP refills and PCP zone lock usage

Steven Rostedt
2026-04-28T18:23:32Z

On Mon, 27 Apr 2026 14:01:42 +0800
Bunyod Suvonov <b.suvonov@sjtu.edu.cn> wrote:

> + TP_STRUCT__entry(
> + __field(int, nid)
> + __field(int, zid)
> + __field(unsigned long, nr_pages)
> + ),
> +
> + TP_fast_assign(
> + __entry->nid = nid;
> + __entry->zid = zid;
> + __entry->nr_pages = nr_pages;
> + ),
> +
> + TP_printk("nid=%d zid=%d nr_pages=%lu",
> + __entry->nid, __entry->zid, __entry->nr_pages)
> +);
> +
> +DEFINE_EVENT(mm_page_pcpu_zone_locked, mm_page_pcpu_refill_zone_locked,
> +
> + TP_PROTO(int nid, int zid, unsigned long nr_pages),
> +
> + TP_ARGS(nid, zid, nr_pages)
> +);
> +
> +DEFINE_EVENT(mm_page_pcpu_zone_locked, mm_page_pcpu_drain_zone_locked,
> +
> + TP_PROTO(int nid, int zid, unsigned long nr_pages),
> +
> + TP_ARGS(nid, zid, nr_pages)
> +);
> +
> +DECLARE_EVENT_CLASS(mm_page_pcpu,
>
> TP_PROTO(struct page *page, unsigned int order, int migratetype),
>
> TP_ARGS(page, order, migratetype),
>
> TP_STRUCT__entry(
> - __field( unsigned long, pfn )
> - __field( unsigned int, order )
> - __field( int, migratetype )
> + __field(unsigned long, pfn)
> + __field(unsigned int, order)
> + __field(int, migratetype)

Why this change? It makes it much harder to understand.

The above is not a normal macro. Ignore any checkpatch warnings about it.
The proper way to do the TP_STRUCT__entry() is to make it just like a struct:

struct {
unsigned long pfn;
unsigned int order;
int migratetype;
};

Thus, the macro should be:

TP_STRUCT__entry(
__field( unsigned long, pfn )
__field( unsigned int, order )
__field( int, migratetype )
),

-- Steve

> ),
>