[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAC_TJvconNNKPboAbsfXFBboiRCYgE2AN23ask1gdaj9=wuHAQ@mail.gmail.com>
Date: Mon, 15 Sep 2025 18:19:53 -0700
From: Kalesh Singh <kaleshsingh@...gle.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: akpm@...ux-foundation.org, minchan@...nel.org, lorenzo.stoakes@...cle.com,
david@...hat.com, Liam.Howlett@...cle.com, rppt@...nel.org, pfalcato@...e.de,
kernel-team@...roid.com, android-mm@...gle.com,
Alexander Viro <viro@...iv.linux.org.uk>, Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Kees Cook <kees@...nel.org>, Vlastimil Babka <vbabka@...e.cz>, Suren Baghdasaryan <surenb@...gle.com>,
Michal Hocko <mhocko@...e.com>, Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>, Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>, Dietmar Eggemann <dietmar.eggemann@....com>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Valentin Schneider <vschneid@...hat.com>, Jann Horn <jannh@...gle.com>, Shuah Khan <shuah@...nel.org>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, linux-trace-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v2 7/7] mm/tracing: introduce max_vma_count_exceeded trace event
On Mon, Sep 15, 2025 at 4:41 PM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> On Mon, 15 Sep 2025 09:36:38 -0700
> Kalesh Singh <kaleshsingh@...gle.com> wrote:
>
> > Needed observability on in field devices can be collected with minimal
> > overhead and can be toggled on and off. Event driven telemetry can be
> > done with tracepoint BPF programs.
> >
> > The process comm is provided for aggregation across devices and tgid is
> > to enable per-process aggregation per device.
>
> What do you mean about comm being used to aggregation across devices?
> What's special about this trace event that will make it used across devices?
>
> Note, if BPF is being used, can't the BPF program just add the current
> comm? Why waste space in the ring buffer for it?
>
>
>
> > +
> > +TRACE_EVENT(max_vma_count_exceeded,
> > +
> > + TP_PROTO(struct task_struct *task),
>
> Why pass in the task if it's always going to be current?
>
> > +
> > + TP_ARGS(task),
> > +
> > + TP_STRUCT__entry(
> > + __string(comm, task->comm)
>
> This could be:
>
> __string(comm, current)
>
> But I still want to know what makes this trace event special over other
> trace events to store this, and can't it be retrieved another way,
> especially if BPF is being used to hook to it?
Hi Steve,
Thanks for the comments and suggestion you are right we can use bpf to
get the comm. There is nothing special about this trace event. I will
drop comm in the next revision.
The reason I did the task_struct parameter (current): I believe there
is a limitation that we must specify at least 1 parameter to the
TRACE_EVENT() PROTO and ARGS macros.
Is there some way to use this without needing a parameter?
I hit the build failure below, with no parameters:
In file included from mm/vma.c:10:
./include/trace/events/vma.h:10:1: error: expected parameter declarator
10 | TRACE_EVENT(max_vma_count_exceeded,
| ^
...
Below is the code for reference:
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM vma
#if !defined(_TRACE_VMA_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_VMA_H
#include <linux/tracepoint.h>
TRACE_EVENT(max_vma_count_exceeded,
TP_PROTO(),
TP_ARGS(),
TP_STRUCT__entry(
__field(pid_t, tgid)
),
TP_fast_assign(
__entry->tgid = current->tgid;
),
TP_printk("tgid=%d", __entry->tgid)
);
#endif /* _TRACE_VMA_H */
/* This part must be outside protection */
#include <trace/define_trace.h>
Thanks,
Kalesh
>
> -- Steve
>
>
> > + __field(pid_t, tgid)
> > + ),
> > +
> > + TP_fast_assign(
> > + __assign_str(comm);
> > + __entry->tgid = task->tgid;
> > + ),
> > +
> > + TP_printk("comm=%s tgid=%d", __get_str(comm), __entry->tgid)
> > +);
> > +
Powered by blists - more mailing lists