Re: [RFC PATCH 1/3] sched/fair: Call newidle_balance() from finish_task_switch()

From: Valentin Schneider
Date: Wed Apr 29 2020 - 08:01:08 EST



On 28/04/20 23:33, Scott Wood wrote:
> On Tue, 2020-04-28 at 22:37 +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.
>
> Any particular benchmark I should try?
>

I'm going to be very original and suggest hackbench :-)

That would just be the first stop however, you would also want to try
something less wakeup-intensive, maybe sysbench and the like - I'm thinking
if you spawn ~1.5*nr_cpu_ids CPU-hogs, you'll hit that double switch fairly
easily.

And then there's always the big boys benchmarks like specjbb and co - I'd
suggest having a look at Mel's mmtests.