From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Yongliang Gao <leonylgao@gmail.com>,
mhiramat@kernel.org, mathieu.desnoyers@efficios.com,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
Yongliang Gao <leonylgao@tencent.com>,
Huang Cun <cunhuang@tencent.com>
Subject: Re: [PATCH] trace/pid_list: optimize pid_list->lock contention
Date: Tue, 11 Nov 2025 09:13:14 +0100 [thread overview]
Message-ID: <20251111081314.j8CFfAD6@linutronix.de> (raw)
In-Reply-To: <20251110183854.48b33b50@gandalf.local.home>
On 2025-11-10 18:38:54 [-0500], Steven Rostedt wrote:
> On Wed, 15 Oct 2025 19:49:52 +0800
> Yongliang Gao <leonylgao@gmail.com> wrote:
>
> > diff --git a/kernel/trace/pid_list.c b/kernel/trace/pid_list.c
> > index 090bb5ea4a19..62082a4f60db 100644
> > --- a/kernel/trace/pid_list.c
> > +++ b/kernel/trace/pid_list.c
> > @@ -138,14 +138,14 @@ bool trace_pid_list_is_set(struct trace_pid_list *pid_list, unsigned int pid)
> > if (pid_split(pid, &upper1, &upper2, &lower) < 0)
> > return false;
> >
> > - raw_spin_lock_irqsave(&pid_list->lock, flags);
> > + read_lock_irqsave(&pid_list->lock, flags);
> > upper_chunk = pid_list->upper[upper1];
> > if (upper_chunk) {
> > lower_chunk = upper_chunk->data[upper2];
> > if (lower_chunk)
> > ret = test_bit(lower, lower_chunk->data);
> > }
> > - raw_spin_unlock_irqrestore(&pid_list->lock, flags);
> > + read_unlock_irqrestore(&pid_list->lock, flags);
> >
> > return ret;
> > }
>
> Unfortunately you cannot do this because this is called while holding the
> task pi_lock and rq locks. In PREEMPT_RT() the read/write_lock_* turn into
> mutexes.
>
> Sebastian, is there any equivalent of raw_read/write_locks() that can be
> used?
Nope, no read-write lock that can be used in atomic sections. Well,
there is RCU.
> -- Steve
Sebastian
next prev parent reply other threads:[~2025-11-11 8:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-15 11:49 Yongliang Gao
2025-11-10 23:38 ` Steven Rostedt
2025-11-11 8:13 ` Sebastian Andrzej Siewior [this message]
2025-11-11 10:38 ` Yongliang Gao
2025-11-11 15:27 ` Steven Rostedt
2025-11-12 5:27 ` Yongliang Gao
2025-11-12 15:42 ` 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=20251111081314.j8CFfAD6@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=cunhuang@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 \
--cc=rostedt@goodmis.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®