[PATCH v5 05/14] sched/deadline: Return EBUSY if dl_bw_cpus is zero

Joel Fernandes posted 14 patches 3 months, 2 weeks ago
There is a newer version of this series
[PATCH v5 05/14] sched/deadline: Return EBUSY if dl_bw_cpus is zero
Posted by Joel Fernandes 3 months, 2 weeks ago
Hotplugged CPUs coming online do an enqueue but are not a part of any
root domain containing cpu_active() CPUs. So in this case, don't mess
with accounting and we can retry later. Without this patch, we see
crashes with sched_ext selftest's hotplug test due to divide by zero.

Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
---
 kernel/sched/deadline.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index d2eb31b45ba9..749c1453a809 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1725,7 +1725,10 @@ int dl_server_apply_params(struct sched_dl_entity *dl_se, u64 runtime, u64 perio
 	cpus = dl_bw_cpus(cpu);
 	cap = dl_bw_capacity(cpu);
 
-	if (__dl_overflow(dl_b, cap, old_bw, new_bw))
+	// Hotplugged CPUs coming online do an enqueue but are not a part of any
+	// root domain containing cpu_active() CPUs. So in this case, don't mess
+	// with accounting and we can retry later.
+	if (!cpus || __dl_overflow(dl_b, cap, old_bw, new_bw))
 		return -EBUSY;
 
 	if (init) {
-- 
2.43.0
Re: [PATCH v5 05/14] sched/deadline: Return EBUSY if dl_bw_cpus is zero
Posted by Tejun Heo 3 months, 2 weeks ago
On Fri, Jun 20, 2025 at 04:32:20PM -0400, Joel Fernandes wrote:
> -	if (__dl_overflow(dl_b, cap, old_bw, new_bw))
> +	// Hotplugged CPUs coming online do an enqueue but are not a part of any
> +	// root domain containing cpu_active() CPUs. So in this case, don't mess
> +	// with accounting and we can retry later.
> +	if (!cpus || __dl_overflow(dl_b, cap, old_bw, new_bw))
>  		return -EBUSY;

Maybe match the comment style in the file?

Thanks.

-- 
tejun
Re: [PATCH v5 05/14] sched/deadline: Return EBUSY if dl_bw_cpus is zero
Posted by Joel Fernandes 3 months, 1 week ago
On Mon, Jun 23, 2025 at 10:20:01AM -1000, Tejun Heo wrote:
> On Fri, Jun 20, 2025 at 04:32:20PM -0400, Joel Fernandes wrote:
> > -	if (__dl_overflow(dl_b, cap, old_bw, new_bw))
> > +	// Hotplugged CPUs coming online do an enqueue but are not a part of any
> > +	// root domain containing cpu_active() CPUs. So in this case, don't mess
> > +	// with accounting and we can retry later.
> > +	if (!cpus || __dl_overflow(dl_b, cap, old_bw, new_bw))
> >  		return -EBUSY;
> 
> Maybe match the comment style in the file?
> 
> Thanks.
> 
> -- 
> tejun

Agreed, will fix. Thanks!

- Joel