Re: [RFC PATCH 6/7] mm: add tracepoints and vmstat counters for async teardown

Steven Rostedt <[email protected]>
Newsgroups org.kernel.vger.linux-trace-kernel,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
On Mon, 20 Jul 2026 00:24:08 +0530
Aditya Sharma <[email protected]> wrote:

> diff --git a/include/trace/events/mm_reaper.h b/include/trace/events/mm_reaper.h
> new file mode 100644
> index 000000000..315bced7c
> --- /dev/null
> +++ b/include/trace/events/mm_reaper.h
> @@ -0,0 +1,73 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM mm_reaper
> +
> +#if !defined(_TRACE_MM_REAPER_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_MM_REAPER_H
> +
> +#include <linux/tracepoint.h>
> +#include <linux/sched.h>
> +#include <linux/topology.h>
> +
> +TRACE_EVENT(mm_async_teardown_queue,
> +
> +	TP_PROTO(struct mm_struct *mm, unsigned long rss),
> +
> +	TP_ARGS(mm, rss),
> +
> +	TP_STRUCT__entry(
> +		__field(struct mm_struct *, mm)
> +		__field(int, pid)
> +		__array(char, comm, TASK_COMM_LEN)

There's an effort to make comm size more dynamic and we want to prevent more
memcpy of the comm based on TASK_COMM_LEN. Please change the above to:

		__string(comm, comm);


> +		__field(unsigned long, rss)
> +		__field(int, node)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->mm = mm;
> +		__entry->pid = current->pid;
> +		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);

And this to:

		__assign_str(comm);

> +		__entry->rss = rss;
> +		__entry->node = numa_node_id();
> +	),
> +
> +	TP_printk("mm=%p pid=%d comm=%s rss=%lukB node=%d",
> +		__entry->mm,
> +		__entry->pid,
> +		__entry->comm,

and this to:

		__get_str(comm),

Thanks,

-- Steve

> +		__entry->rss << (PAGE_SHIFT - 10),
> +		__entry->node
> +	)
> +);
> +
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.