* [PATCH] sched_ext: Remove redundant rcu_read_lock/unlock() in sysrq_handle_sched_ext_reset()
@ 2026-04-30 8:45 Zqiang
2026-05-03 13:10 ` Cheng-Yang Chou
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Zqiang @ 2026-04-30 8:45 UTC (permalink / raw)
To: tj, void, arighi, changwoo; +Cc: sched-ext, linux-kernel, qiang.zhang
The sysrq_handle_sched_ext_reset() callback has already been
executed in the rcu read critical section within __handle_sysrq(),
this commit therefore remove redundant rcu_read_lock/unlock() in
the sysrq_handle_sched_ext_reset().
Signed-off-by: Zqiang <qiang.zhang@linux.dev>
---
kernel/sched/ext.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 45a2668284bc..0f3e9d088151 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -7953,13 +7953,11 @@ static void sysrq_handle_sched_ext_reset(u8 key)
{
struct scx_sched *sch;
- rcu_read_lock();
sch = rcu_dereference(scx_root);
if (likely(sch))
scx_disable(sch, SCX_EXIT_SYSRQ);
else
pr_info("sched_ext: BPF schedulers not loaded\n");
- rcu_read_unlock();
}
static const struct sysrq_key_op sysrq_sched_ext_reset_op = {
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] sched_ext: Remove redundant rcu_read_lock/unlock() in sysrq_handle_sched_ext_reset()
2026-04-30 8:45 [PATCH] sched_ext: Remove redundant rcu_read_lock/unlock() in sysrq_handle_sched_ext_reset() Zqiang
@ 2026-05-03 13:10 ` Cheng-Yang Chou
2026-05-04 5:17 ` Andrea Righi
2026-05-04 21:05 ` Tejun Heo
2 siblings, 0 replies; 5+ messages in thread
From: Cheng-Yang Chou @ 2026-05-03 13:10 UTC (permalink / raw)
To: Zqiang
Cc: tj, void, arighi, changwoo, sched-ext, linux-kernel,
Ching-Chun Huang, Chia-Ping Tsai
Hi Zqiang,
On Thu, Apr 30, 2026 at 04:45:43PM +0800, Zqiang wrote:
> The sysrq_handle_sched_ext_reset() callback has already been
> executed in the rcu read critical section within __handle_sysrq(),
> this commit therefore remove redundant rcu_read_lock/unlock() in
Nit: s/remove/removes
Looks good!
Reviewed-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
> the sysrq_handle_sched_ext_reset().
>
> Signed-off-by: Zqiang <qiang.zhang@linux.dev>
> ---
> kernel/sched/ext.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 45a2668284bc..0f3e9d088151 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -7953,13 +7953,11 @@ static void sysrq_handle_sched_ext_reset(u8 key)
> {
> struct scx_sched *sch;
>
> - rcu_read_lock();
> sch = rcu_dereference(scx_root);
> if (likely(sch))
> scx_disable(sch, SCX_EXIT_SYSRQ);
> else
> pr_info("sched_ext: BPF schedulers not loaded\n");
> - rcu_read_unlock();
> }
>
> static const struct sysrq_key_op sysrq_sched_ext_reset_op = {
> --
> 2.17.1
>
>
--
Cheers,
Cheng-Yang
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] sched_ext: Remove redundant rcu_read_lock/unlock() in sysrq_handle_sched_ext_reset()
2026-04-30 8:45 [PATCH] sched_ext: Remove redundant rcu_read_lock/unlock() in sysrq_handle_sched_ext_reset() Zqiang
2026-05-03 13:10 ` Cheng-Yang Chou
@ 2026-05-04 5:17 ` Andrea Righi
2026-05-04 5:24 ` Andrea Righi
2026-05-04 21:05 ` Tejun Heo
2 siblings, 1 reply; 5+ messages in thread
From: Andrea Righi @ 2026-05-04 5:17 UTC (permalink / raw)
To: Zqiang; +Cc: tj, void, changwoo, sched-ext, linux-kernel
Hi Zqiang,
On Thu, Apr 30, 2026 at 04:45:43PM +0800, Zqiang wrote:
> The sysrq_handle_sched_ext_reset() callback has already been
> executed in the rcu read critical section within __handle_sysrq(),
> this commit therefore remove redundant rcu_read_lock/unlock() in
> the sysrq_handle_sched_ext_reset().
>
> Signed-off-by: Zqiang <qiang.zhang@linux.dev>
Looks good to me.
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Thanks,
-Andrea
> ---
> kernel/sched/ext.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 45a2668284bc..0f3e9d088151 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -7953,13 +7953,11 @@ static void sysrq_handle_sched_ext_reset(u8 key)
> {
> struct scx_sched *sch;
>
> - rcu_read_lock();
> sch = rcu_dereference(scx_root);
> if (likely(sch))
> scx_disable(sch, SCX_EXIT_SYSRQ);
> else
> pr_info("sched_ext: BPF schedulers not loaded\n");
> - rcu_read_unlock();
> }
>
> static const struct sysrq_key_op sysrq_sched_ext_reset_op = {
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] sched_ext: Remove redundant rcu_read_lock/unlock() in sysrq_handle_sched_ext_reset()
2026-05-04 5:17 ` Andrea Righi
@ 2026-05-04 5:24 ` Andrea Righi
0 siblings, 0 replies; 5+ messages in thread
From: Andrea Righi @ 2026-05-04 5:24 UTC (permalink / raw)
To: Zqiang; +Cc: tj, void, changwoo, sched-ext, linux-kernel
On Mon, May 04, 2026 at 07:17:16AM +0200, Andrea Righi wrote:
> Hi Zqiang,
>
> On Thu, Apr 30, 2026 at 04:45:43PM +0800, Zqiang wrote:
> > The sysrq_handle_sched_ext_reset() callback has already been
> > executed in the rcu read critical section within __handle_sysrq(),
> > this commit therefore remove redundant rcu_read_lock/unlock() in
> > the sysrq_handle_sched_ext_reset().
Actually, minor nits in the commit message:
1) s/has already been executed/is executed/
2) s/remove/removes/
Or maybe rephrase as following?
sysrq_handle_sched_ext_reset() is called from __handle_sysrq(), which already
holds rcu_read_lock() while invoking the sysrq handler. Remove the redundant
rcu_read_lock/unlock() pair.
Thanks,
-Andrea
> >
> > Signed-off-by: Zqiang <qiang.zhang@linux.dev>
>
> Looks good to me.
>
> Reviewed-by: Andrea Righi <arighi@nvidia.com>
>
> Thanks,
> -Andrea
>
> > ---
> > kernel/sched/ext.c | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> > index 45a2668284bc..0f3e9d088151 100644
> > --- a/kernel/sched/ext.c
> > +++ b/kernel/sched/ext.c
> > @@ -7953,13 +7953,11 @@ static void sysrq_handle_sched_ext_reset(u8 key)
> > {
> > struct scx_sched *sch;
> >
> > - rcu_read_lock();
> > sch = rcu_dereference(scx_root);
> > if (likely(sch))
> > scx_disable(sch, SCX_EXIT_SYSRQ);
> > else
> > pr_info("sched_ext: BPF schedulers not loaded\n");
> > - rcu_read_unlock();
> > }
> >
> > static const struct sysrq_key_op sysrq_sched_ext_reset_op = {
> > --
> > 2.17.1
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] sched_ext: Remove redundant rcu_read_lock/unlock() in sysrq_handle_sched_ext_reset()
2026-04-30 8:45 [PATCH] sched_ext: Remove redundant rcu_read_lock/unlock() in sysrq_handle_sched_ext_reset() Zqiang
2026-05-03 13:10 ` Cheng-Yang Chou
2026-05-04 5:17 ` Andrea Righi
@ 2026-05-04 21:05 ` Tejun Heo
2 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2026-05-04 21:05 UTC (permalink / raw)
To: Zqiang
Cc: David Vernet, Andrea Righi, Changwoo Min, Cheng-Yang Chou,
sched-ext, linux-kernel
Hello,
Applied to sched_ext/for-7.2 with Andrea's suggested commit message
rewording and both Reviewed-by tags.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-04 21:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-30 8:45 [PATCH] sched_ext: Remove redundant rcu_read_lock/unlock() in sysrq_handle_sched_ext_reset() Zqiang
2026-05-03 13:10 ` Cheng-Yang Chou
2026-05-04 5:17 ` Andrea Righi
2026-05-04 5:24 ` Andrea Righi
2026-05-04 21:05 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox