Re: [PATCH] sched: pull tasks when CPU is about to run SCHED_IDLE tasks
From: Vincent Guittot
Date: Wed Dec 23 2020 - 06:31:21 EST
On Wed, 23 Dec 2020 at 09:32, <ultrachin@xxxxxxx> wrote:
>
> From: Chen Xiaoguang <xiaoggchen@xxxxxxxxxxx>
>
> Before a CPU switches from running SCHED_NORMAL task to
> SCHED_IDLE task, trying to pull SCHED_NORMAL tasks from other
Could you explain more in detail why you only care about this use case
in particular and not the general case?
> CPU by doing load_balance first.
>
> Signed-off-by: Chen Xiaoguang <xiaoggchen@xxxxxxxxxxx>
> Signed-off-by: Chen He <heddchen@xxxxxxxxxxx>
> ---
> kernel/sched/fair.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index ae7ceba..0a26132 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -7004,6 +7004,11 @@ struct task_struct *
> struct task_struct *p;
> int new_tasks;
>
> + if (prev &&
> + fair_policy(prev->policy) &&
Why do you need a prev and fair task ? You seem to target the special
case of pick_next_task but in this case why not only testing rf!=null
to make sure to not return immediately after jumping to the idle
label?
Also why not doing that for default case too ? i.e. balance_fair() ?
> + sched_idle_cpu(rq->cpu))
> + goto idle;
> +
> again:
> if (!sched_fair_runnable(rq))
> goto idle;
> --
> 1.8.3.1
>
>