Re: [PATCH] sched_ext: Remove redundant rcu_read_lock/unlock() in sysrq_handle_sched_ext_reset()

From: Andrea Righi

Date: Mon May 04 2026 - 01:17:33 EST


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@xxxxxxxxx>

Looks good to me.

Reviewed-by: Andrea Righi <arighi@xxxxxxxxxx>

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
>