Closed hamadmarri closed 2 years ago
Thank you very much for pointing that out, Hamad. After ptr reported me about his 5.15-bore backport failing to boot in a few people's rigs, I was reviewing my own code when I found the same thing and thought the same way that it "could be logically possible" that nr_running == 0, but I left it since if 0-1 == uint_max, in this case the division result would be like super small but at least not error, and also I thought if nr_running is less than 2, then task switch wouldn't be invoked. I admit I was being too optimistic. I've just fixed the code and tagged/pushed it as 20.1 (#20 Fix 1). Thanks again for your contribution!
It has been fixed in #20.1. Now closing the issue.
https://github.com/firelzrd/bore-scheduler/blob/3f2dd489818750e43b9cb37192b6e3381fb1a5f8/patches/5.15.10-rt24-xanmod1_bore19.3-cacule.patch#L270
There is a chance that
nr_running
equals to zero even if there is a task. By decrementing it by 1, this will results to unsigned int max. To be safe, it is better to useh_nr_running
since this includes all normal, batch, and idle tasks.To be safer, make a
if
check for zero case.Thank you