On Tue, Apr 28, 2020 at 10:37:18PM +0100, Valentin Schneider wrote: > > On 28/04/20 06:02, Scott Wood wrote: > > Thus, newidle_balance() is entered with interrupts enabled, which allows > > (in the next patch) enabling interrupts when the lock is dropped. > > > > Signed-off-by: Scott Wood <swood@xxxxxxxxxx> > > --- > > kernel/sched/core.c | 7 ++++--- > > kernel/sched/fair.c | 45 ++++++++++++++++---------------------------- > > kernel/sched/sched.h | 6 ++---- > > 3 files changed, 22 insertions(+), 36 deletions(-) > > > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > index 9a2fbf98fd6f..0294beb8d16c 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -3241,6 +3241,10 @@ static struct rq *finish_task_switch(struct task_struct *prev) > > } > > > > tick_nohz_task_switch(); > > + > > + if (is_idle_task(current)) > > + newidle_balance(); > > + > > This means we must go through a switch_to(idle) before figuring out we > could've switched to a CFS task, and do it then. I'm curious to see the > performance impact of that. Also, if you move it this late, this is entirely the wrong place. If you do it after the context switch either use the balance_callback or put it in the idle path. But what Valentin said; this needs a fair bit of support, the whole reason we've never done this is to avoid that double context switch...