[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250322050300.3c470f61@batman.local.home>
Date: Sat, 22 Mar 2025 05:03:00 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Martin Liu <liumartin@...gle.com>
Cc: Masami Hiramatsu <mhiramat@...nel.org>, Mathieu Desnoyers
<mathieu.desnoyers@...icios.com>, Andrew Morton
<akpm@...ux-foundation.org>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v2 2/3] mm/page_alloc: Add trace event for per-zone
lowmem reserve setup
On Sat, 8 Mar 2025 03:46:01 +0000
Martin Liu <liumartin@...gle.com> wrote:
> ---
> include/trace/events/kmem.h | 27 +++++++++++++++++++++++++++
> mm/page_alloc.c | 2 ++
> 2 files changed, 29 insertions(+)
>
> diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
> index 5fd392dae503..9623e68d4d26 100644
> --- a/include/trace/events/kmem.h
> +++ b/include/trace/events/kmem.h
> @@ -375,6 +375,33 @@ TRACE_EVENT(mm_setup_per_zone_wmarks,
> __entry->watermark_promo)
> );
>
> +TRACE_EVENT(mm_setup_per_zone_lowmem_reserve,
> +
> + TP_PROTO(struct zone *zone, struct zone *upper_zone, long lowmem_reserve),
> +
> + TP_ARGS(zone, upper_zone, lowmem_reserve),
> +
> + TP_STRUCT__entry(
> + __field(int, node_id)
> + __string(name, zone->name)
> + __string(upper_name, upper_zone->name)
> + __field(long, lowmem_reserve)
Nit, but may be useful. If you want to remove "holes" from the trace
event, I would move the lowmem_reserve to the top. The __string() macro
adds a 4 byte meta data into the structure (that defines the size and
offset of where the string is). That means you can think of __string()
as the same as "int".
The above has three int's followed by a long which on 64bit, would
leave a 4 byte hole just before lowmem_reserve.
-- Steve
> + ),
> +
> + TP_fast_assign(
> + __entry->node_id = zone->zone_pgdat->node_id;
> + __assign_str(name);
> + __assign_str(upper_name);
> + __entry->lowmem_reserve = lowmem_reserve;
> + ),
> +
> + TP_printk("node_id=%d zone name=%s upper_zone name=%s lowmem_reserve_pages=%ld",
> + __entry->node_id,
> + __get_str(name),
> + __get_str(upper_name),
> + __entry->lowmem_reserve)
> +);
> +
Powered by blists - more mailing lists