On Mon, Sep 15, 2025 at 4:41 PM Steven Rostedt rostedt@goodmis.org wrote:
On Mon, 15 Sep 2025 09:36:38 -0700 Kalesh Singh kaleshsingh@google.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)
+);