From: Steven Rostedt <rostedt@goodmis.org>
To: Yongliang Gao <leonylgao@gmail.com>
Cc: mhiramat@kernel.org, mathieu.desnoyers@efficios.com,
bigeasy@linutronix.de, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, frankjpliu@tencent.com,
Yongliang Gao <leonylgao@tencent.com>,
Huang Cun <cunhuang@tencent.com>
Subject: Re: [PATCH v3] trace/pid_list: optimize pid_list->lock contention
Date: Wed, 12 Nov 2025 19:21:26 -0500 [thread overview]
Message-ID: <20251112192126.76a4cb9a@gandalf.local.home> (raw)
In-Reply-To: <20251113000252.1058144-1-leonylgao@gmail.com>
On Thu, 13 Nov 2025 08:02:52 +0800
Yongliang Gao <leonylgao@gmail.com> wrote:
> From: Yongliang Gao <leonylgao@tencent.com>
>
> When the system has many cores and task switching is frequent,
> setting set_ftrace_pid can cause frequent pid_list->lock contention
> and high system sys usage.
>
> For example, in a 288-core VM environment, we observed 267 CPUs
> experiencing contention on pid_list->lock, with stack traces showing:
>
> #4 [ffffa6226fb4bc70] native_queued_spin_lock_slowpath at ffffffff99cd4b7e
> #5 [ffffa6226fb4bc90] _raw_spin_lock_irqsave at ffffffff99cd3e36
> #6 [ffffa6226fb4bca0] trace_pid_list_is_set at ffffffff99267554
> #7 [ffffa6226fb4bcc0] trace_ignore_this_task at ffffffff9925c288
> #8 [ffffa6226fb4bcd8] ftrace_filter_pid_sched_switch_probe at ffffffff99246efe
> #9 [ffffa6226fb4bcf0] __schedule at ffffffff99ccd161
>
> Replaces the existing spinlock with a seqlock to allow concurrent readers,
> while maintaining write exclusivity.
>
> ---
> Changes from v2:
> - Keep trace_pid_list_next() using raw_spin_lock for simplicity. [Steven Rostedt]
> - Link to v2: https://lore.kernel.org/all/20251112181456.473864-1-leonylgao@gmail.com
> Changes from v1:
> - Fixed sleep-in-atomic issues under PREEMPT_RT. [Steven Rostedt]
> - Link to v1: https://lore.kernel.org/all/20251015114952.4014352-1-leonylgao@gmail.com
> ---
You don't need to resend, but the "Changes from" needs to go below the
'---' after the tags. Otherwise, git am removes everything from the above
'---', including your tags below.
-- Steve
>
> Signed-off-by: Yongliang Gao <leonylgao@tencent.com>
> Reviewed-by: Huang Cun <cunhuang@tencent.com>
> ---
> kernel/trace/pid_list.c | 30 +++++++++++++++++++++---------
> kernel/trace/pid_list.h | 1 +
> 2 files changed, 22 insertions(+), 9 deletions(-)
>
next prev parent reply other threads:[~2025-11-13 0:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 0:02 Yongliang Gao
2025-11-13 0:21 ` Steven Rostedt [this message]
2025-11-13 7:34 ` Sebastian Andrzej Siewior
2025-11-13 11:13 ` Yongliang Gao
2025-11-13 14:15 ` Sebastian Andrzej Siewior
2025-11-13 15:05 ` Steven Rostedt
2025-11-13 15:17 ` Sebastian Andrzej Siewior
2025-11-13 15:24 ` Steven Rostedt
2025-11-13 15:35 ` Sebastian Andrzej Siewior
2025-11-13 15:51 ` Steven Rostedt
2025-11-13 16:07 ` Sebastian Andrzej Siewior
2025-11-13 16:14 ` Steven Rostedt
2025-11-13 15:35 ` 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=20251112192126.76a4cb9a@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=bigeasy@linutronix.de \
--cc=cunhuang@tencent.com \
--cc=frankjpliu@tencent.com \
--cc=leonylgao@gmail.com \
--cc=leonylgao@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-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
all inboxes | Powered by JetHome®