lkml.org 
[lkml]   [2013]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched: Get rid of unnecessary checks from select_idle_sibling
On 01/09/2013 02:50 PM, Namhyung Kim wrote:
> From: Namhyung Kim <namhyung.kim@lge.com>
>
> AFAICS @target cpu of select_idle_sibling() is always either prev_cpu
> or this_cpu. So no need to check it again and the conditionals can be
> consolidated.
>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com>
> Cc: Vincent Guittot <vincent.guittot@linaro.org>
> Cc: Alex Shi <alex.shi@intel.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> kernel/sched/fair.c | 17 ++++-------------
> 1 file changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 5eea8707234a..af665814c216 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -3254,25 +3254,16 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
> */
> static int select_idle_sibling(struct task_struct *p, int target)
> {
> - int cpu = smp_processor_id();
> - int prev_cpu = task_cpu(p);
> struct sched_domain *sd;
> struct sched_group *sg;
> int i;
>
> /*
> - * If the task is going to be woken-up on this cpu and if it is
> - * already idle, then it is the right target.
> - */
> - if (target == cpu && idle_cpu(cpu))
> - return cpu;
> -
> - /*
> - * If the task is going to be woken-up on the cpu where it previously
> - * ran and if it is currently idle, then it the right target.
> + * If the task is going to be woken-up on this cpu or the cpu where it
> + * previously ran and it is already idle, then it is the right target.
> */
> - if (target == prev_cpu && idle_cpu(prev_cpu))
> - return prev_cpu;
> + if (idle_cpu(target))
> + return target;

Uh, we don't know if the target is this_cpu or previous cpu, If we just
check the target idle status, we may miss another idle cpu. So this
patch change the logical in this function.

>
> /*
> * Otherwise, iterate the domains and find an elegible idle cpu.
>


--
Thanks Alex


\
 
 \ /
  Last update: 2013-01-09 09:21    [W:0.207 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site