| Date | Fri, 26 Apr 2019 16:02:09 +0200 | From | Peter Zijlstra <> | Subject | Re: [RFC PATCH v2 09/17] sched: Introduce sched_class::pick_task() |
| |
On Tue, Apr 23, 2019 at 04:18:14PM +0000, Vineeth Remanan Pillai wrote: > +static struct task_struct * > +pick_task_fair(struct rq *rq) > +{ > + struct cfs_rq *cfs_rq = &rq->cfs; > + struct sched_entity *se; > + > + if (!cfs_rq->nr_running) > + return NULL; > + > + do { > + struct sched_entity *curr = cfs_rq->curr; > + > + se = pick_next_entity(cfs_rq, NULL); > + > + if (!(se || curr)) > + return NULL;
I didn't get around to reading the original discussion here, but how can that possibly be?
I can see !se, in that case curr is still selected.
I can also see !curr, in that case curr is put.
But I cannot see !se && !curr, per the above check we know cfs_rq->nr_running != 0, so there must be a cfs task to find. This means either curr or se must exist.
> + > + if (curr) { > + if (se && curr->on_rq) > + update_curr(cfs_rq); > + > + if (!se || entity_before(curr, se)) > + se = curr; > + } > + > + cfs_rq = group_cfs_rq(se); > + } while (cfs_rq); > + > + return task_of(se); > +}
|