Re: [PATCH v2 1/5] sched/fair: Move select_task_rq_fair slow-path into its own function

From: Josef Bacik
Date: Fri Aug 25 2017 - 08:22:51 EST


On Fri, Aug 25, 2017 at 11:16:28AM +0100, Brendan Jackman wrote:
> In preparation for changes that would otherwise require adding a new
> level of indentation to the while(sd) loop, create a new function
> find_idlest_cpu which contains this loop, and rename the existing
> find_idlest_cpu to find_idlest_group_cpu.
>
> Code inside the while(sd) loop is unchanged. @new_cpu is added as a
> variable in the new function, with the same initial value as the
> @new_cpu in select_task_rq_fair.
>
> Suggested-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Signed-off-by: Brendan Jackman <brendan.jackman@xxxxxxx>
> Cc: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
> Cc: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
> Cc: Josef Bacik <josef@xxxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Morten Rasmussen <morten.rasmussen@xxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
>
> squash! sched/fair: Move select_task_rq_fair slow-path into its own function
> ---
> kernel/sched/fair.c | 83 +++++++++++++++++++++++++++++++----------------------
> 1 file changed, 48 insertions(+), 35 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index c95880e216f6..f6e277c65235 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5509,10 +5509,10 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,
> }
>
> /*
> - * find_idlest_cpu - find the idlest cpu among the cpus in group.
> + * find_idlest_group_cpu - find the idlest cpu among the cpus in group.
> */
> static int
> -find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
> +find_idlest_group_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)

I hate this name but can't think of something that isn't unreasonably long
either.

Reviewed-by: Josef Bacik <jbacik@xxxxxx>

Thanks,

Josef