sched: Fix priority inversion of cookied task with sibling
Hello Joel Fernandes (Google),
This is a semi-automatic email about new static checker warnings.
The patch 7afbba119f0d: "sched: Fix priority inversion of cookied task with sibling" from Nov 17, 2020, leads to the following Smatch complaint:
kernel/sched/core.c:5492 pick_next_task()
error: we previously assumed 'next' could be null (see line 5488)
kernel/sched/core.c
5481 /*
5482 * Optimize for common case where this CPU has no cookies 5483 * and there are no cookied tasks running on siblings. 5484 */
5485 if (!need_sync) {
5486 for_each_class(class) {
5487 next = class->pick_task(rq);
5488 if (next)
5489 break;
Is it possible to go through the whole loop withint finding a next?
5490 }
5491
5492 if (!next->core_cookie) {
^^^^^^^^^^^^^^^^^I assume not, but I don't read the code, I just forward the warnings on. I am a bot. Beep Boop!
5493 rq->core_pick = NULL;
5494 /*
5495 * For robustness, update the min_vruntime_fi for
5496 * unconstrained picks as well.
5497 */
5498 WARN_ON_ONCE(fi_before);
5499 task_vruntime_update(rq, next, false);
5500 goto done;
5501 }
5502 }
5503
5504 for_each_cpu(i, smt_mask) {
5505 struct rq *rq_i = cpu_rq(i);
5506 regards,
dan carpenter