The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [for-next][PATCH 2/8] tracing: Do not bother getting user space stacktraces for kernel threads
Date: Wed, 02 Dec 2026 03:14:38 -0500	[thread overview]
Message-ID: <20261202081459.971645197@kernel.org> (raw)
In-Reply-To: 20261202081436.100375310@kernel.org

From: Steven Rostedt <rostedt@goodmis.org>

If a user space stacktrace is requested when running a kernel thread, just
return, as there's no point trying to get the user space stacktrace as
there is no user space.

Link: https://patch.msgid.link/20261130145215.347d42c0@gandalf.local.home
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 926a2eb247df..181b565786a9 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2280,6 +2280,10 @@ ftrace_trace_userstack(struct trace_array *tr,
 	if (!(tr->trace_flags & TRACE_ITER(USERSTACKTRACE)))
 		return;
 
+	/* No point doing user space stacktraces on kernel threads */
+	if (!is_user_task(current))
+		return;
+
 	/*
 	 * NMIs can not handle page faults, even with fix ups.
 	 * The save user stack can (and often does) fault.
-- 
2.53.0

  parent reply	other threads:[~2026-12-02  8:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  8:14 [for-next][PATCH 0/8] tracing: Updates for v7.5 Steven Rostedt
2026-12-02  8:14 ` [for-next][PATCH 1/8] tracing: Rename __dynamic_array() to __dynamic_field() for ftrace events Steven Rostedt
2026-12-02  8:14 ` Steven Rostedt [this message]
2026-12-02  8:14 ` [for-next][PATCH 3/8] tracing: Drop duplicated NO_CMDLINE_MAP check in saved_cmdlines_next() Steven Rostedt
2026-12-02  8:14 ` [for-next][PATCH 4/8] tracing: Add __print_sym() to replace __print_symbolic() Steven Rostedt
2026-12-02  8:14 ` [for-next][PATCH 5/8] net: dropreason: use new __print_sym() in tracing Steven Rostedt
2026-12-02  8:14 ` [for-next][PATCH 6/8] net: drop_monitor: use drop_reason_lookup() Steven Rostedt
2026-12-02  8:14 ` [for-next][PATCH 7/8] tracing: Dont use TRACE_BRANCH_BIT as a mask Steven Rostedt
2026-12-02  8:14 ` [for-next][PATCH 8/8] tracing: Use test_bit() in event_enable_count_probe() Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202081459.971645197@kernel.org \
    --to=rostedt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox