Re: [PATCH 02/12] sched_ext: Avoid NULL scx_root deref through SCX_HAS_OP()
From: Tejun Heo
Date: Thu Apr 24 2025 - 14:55:51 EST
Hello,
On Thu, Apr 24, 2025 at 03:23:40PM +0800, Chengming Zhou wrote:
> > + /*
> > + * scx_root updates are protected by cpus_read_lock() and will stay
> > + * stable here. Note that we can't depend on scx_enabled() test as the
> > + * hotplug ops need to be enabled before __scx_enabled is set.
> > + */
> > + if (!scx_root)
> > + return;
> > +
> > if (scx_enabled())
> > scx_idle_update_selcpu_topology(&scx_root->ops);
>
> Just be curious, does the comments added above mean we shouldn't
> check scx_enabled() here anymore?
There are two things happening in the function - calling the idle topology
update function and calling ops.cpu_on/offline(). The former needs both
scx_root and scx_enabled(). The latter only scx_root, so we still need the
additional scx_enabled() check for the former.
Thanks.
--
tejun