Re: [PATCH v2 1/3] sched: Tell rq_online() and rq_offline() whether the CPU changes state
From: Li kunyu
Date: Thu Nov 19 2026 - 21:24:52 EST
Hi Qiliang,
On 2026/11/20 9:51, Qiliang Yuan wrote:
> On Thu, Nov 19, 2026 at 04:29:27PM +0800, Li kunyu wrote:
>> Is this parameter currently unused, or is it being introduced at the callback
>> layer in advance for future use cases?
>
> Only the fair class uses it, later in this series:
>
> callback uses hotplug
> rq_offline_fair() yes, patch 2 returns early when !hotplug
> rq_online_fair() yes, patch 3 calls update_runtime_enabled()
> only when hotplug is true
Thank you for the explanation. I have indeed located the relevant calls in
Patches 2 and 3.
> rq_online_rt(), rq_offline_rt() no
> rq_online_dl(), rq_offline_dl() no
>
> The rt and dl callbacks take it only because they share the
> sched_class callback type, and they have no use for it, whatever
> tasks run on the CPU. They move state that lives in the root domain,
> so they have to do the same work on hotplug and on a root domain
> change:
>
> callback work why also on !hotplug
> rq_offline_rt() rt_clear_overload(), rto_mask and cpupri live in
> __disable_runtime(), rq->rd, so leave the old root
> cpupri -> CPUPRI_INVALID domain; reclaim RT runtime
> lent within it
> rq_online_rt() rt_set_overload(), register the overload state
> __enable_runtime(), and the highest RT priority in
> cpupri_set() the new root domain for push/pull
> rq_offline_dl() dl_clear_overload(), dlo_mask and cpudl live in
> cpudl_clear() rq->rd, so leave the old root
> domain
> rq_online_dl() dl_set_overload(), register the earliest deadline
> cpudl_set()/cpudl_clear() in the new root domain for
> push/pull
>
> The fair callbacks handle task group state (throttling and the
> bandwidth switch), which doesn't depend on the root domain, so they
> can skip it when the CPU stays active.
>
> Passing a bool follows Peter's suggestion on v1 [1]. Prateek proposed
> instead to give root domain changes their own callbacks, implemented
> by rt and dl only, which leaves rq_online() and rq_offline() to CPU
> hotplug and needs no parameter [2].
>
> As only the fair class needs the distinction, I'll rework the series
> along Prateek's lines in v3, so that rt and dl don't carry a
> parameter they never use.
>
> [1] https://lore.kernel.org/r/20261112125947.GZ1813469@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> [2] https://lore.kernel.org/r/e1a63a3c-3975-4b05-8ab4-518c37d867d6@xxxxxxx
>
> Thanks,
> Qiliang
>
Looking forward to the improvements in the v3!
--
thanks,
kunyu