Messages in this thread Patch in this message | | | Date | Fri, 28 Aug 2020 23:25:54 +0200 | From | Peter Zijlstra <> | Subject | Re: [RFC PATCH v7 09/23] sched/fair: Fix forced idle sibling starvation corner case |
| |
On Fri, Aug 28, 2020 at 03:51:10PM -0400, Julien Desfossez wrote: > +/* > + * If runqueue has only one task which used up its slice and if the sibling > + * is forced idle, then trigger schedule to give forced idle task a chance. > + */ > +static void resched_forceidle_sibling(struct rq *rq, struct sched_entity *se) > +{ > + int cpu = cpu_of(rq), sibling_cpu; > + > + if (rq->cfs.nr_running > 1 || !__entity_slice_used(se)) > + return; > + > + for_each_cpu(sibling_cpu, cpu_smt_mask(cpu)) { > + struct rq *sibling_rq; > + if (sibling_cpu == cpu) > + continue; > + if (cpu_is_offline(sibling_cpu)) > + continue; > + > + sibling_rq = cpu_rq(sibling_cpu); > + if (sibling_rq->core_forceidle) { > + resched_curr(sibling_rq); > + } > + }
The only pupose of this loop seem to be to find if we have a forceidle; surely we can avoid that by storing this during the pick.
> +}
static void task_tick_core(struct rq *rq) { if (sched_core_enabled(rq)) resched_forceidle_sibling(rq, &rq->curr->se); }
#else
static void task_tick_core(struct rq *rq) { }
> +#endif > + > /* > * scheduler tick hitting a task of our scheduling class. > * > @@ -10654,6 +10688,11 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued) > > update_misfit_status(curr, rq); > update_overutilized_status(task_rq(curr)); > + > +#ifdef CONFIG_SCHED_CORE > + if (sched_core_enabled(rq)) > + resched_forceidle_sibling(rq, &curr->se); > +#endif
Then you can ditch the #ifdef here
> } > > /* > -- > 2.17.1 >
| |