Re: [PATCH 04/16] sched/deadline: Do not divide by zero active CPUs of a root domain

From: Mathieu Desnoyers

Date: Wed Nov 18 2026 - 16:08:54 EST


> This problem wasn't introduced by this patch, but can casting tsk_bw to
> s32 in __dl_sub() and __dl_add() overflow and flip the sign [1]?

Yes, by reading. cpuset_can_attach() passes the sum of the bandwidth of
the tasks it moves to dl_bw_alloc(), which calls __dl_add() with it.
One CPU is 1 << 20, so the sum goes above S32_MAX past 2048 CPUs of
deadline bandwidth. That needs a machine with more than 2048 CPUs.

This series does not change the cast. I will fix it in a separate
patch, with a 64-bit division.

Thanks,

Mathieu

--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com