* [RFC/PATCH] sched: Honor sync wake up in select_idle_sibling
@ 2012-08-10 7:25 Namhyung Kim
2012-08-10 8:14 ` Mike Galbraith
0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2012-08-10 7:25 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra
Cc: LKML, Namhyung Kim, Mike Galbraith, Suresh Siddha
From: Namhyung Kim <namhyung.kim@lge.com>
When sync wakeup happens and there's the waker task running alone,
select the target cpu as if it's already idle.
Cc: Mike Galbraith <efault@gmx.de>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
kernel/sched/fair.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d0cc03b3e70b..64b68bc82b52 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2632,7 +2632,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
/*
* Try and locate an idle CPU in the sched_domain.
*/
-static int select_idle_sibling(struct task_struct *p, int target)
+static int select_idle_sibling(struct task_struct *p, int target, int sync)
{
int cpu = smp_processor_id();
int prev_cpu = task_cpu(p);
@@ -2646,6 +2646,13 @@ static int select_idle_sibling(struct task_struct *p, int target)
return cpu;
/*
+ * If the task is going to be woken-up on this cpu and there's only
+ * the sync-waker running, then it is the right target.
+ */
+ if (target == cpu && sync && this_rq()->nr_running == 1)
+ 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.
*/
@@ -2748,7 +2755,7 @@ select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flags)
if (cpu == prev_cpu || wake_affine(affine_sd, p, sync))
prev_cpu = cpu;
- new_cpu = select_idle_sibling(p, prev_cpu);
+ new_cpu = select_idle_sibling(p, prev_cpu, sync);
goto unlock;
}
--
1.7.11.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC/PATCH] sched: Honor sync wake up in select_idle_sibling
2012-08-10 7:25 [RFC/PATCH] sched: Honor sync wake up in select_idle_sibling Namhyung Kim
@ 2012-08-10 8:14 ` Mike Galbraith
2012-08-10 8:51 ` Namhyung Kim
0 siblings, 1 reply; 3+ messages in thread
From: Mike Galbraith @ 2012-08-10 8:14 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Peter Zijlstra, LKML, Namhyung Kim, Suresh Siddha
On Fri, 2012-08-10 at 16:25 +0900, Namhyung Kim wrote:
> From: Namhyung Kim <namhyung.kim@lge.com>
>
> When sync wakeup happens and there's the waker task running alone,
> select the target cpu as if it's already idle.
Ouch. That defeats the purpose of select_idle_sibling(). Just because
we're doing a sync wakeup does not mean there's no convertible overlap,
nor that the waker is really really going to take a nap immediately. A
lot of the places that benefit up to and including hugely from looking
for an idle shared cache to wake to do sync wakeups.
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Suresh Siddha <suresh.b.siddha@intel.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> kernel/sched/fair.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index d0cc03b3e70b..64b68bc82b52 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -2632,7 +2632,7 @@ find_idlest_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
> /*
> * Try and locate an idle CPU in the sched_domain.
> */
> -static int select_idle_sibling(struct task_struct *p, int target)
> +static int select_idle_sibling(struct task_struct *p, int target, int sync)
> {
> int cpu = smp_processor_id();
> int prev_cpu = task_cpu(p);
> @@ -2646,6 +2646,13 @@ static int select_idle_sibling(struct task_struct *p, int target)
> return cpu;
>
> /*
> + * If the task is going to be woken-up on this cpu and there's only
> + * the sync-waker running, then it is the right target.
> + */
> + if (target == cpu && sync && this_rq()->nr_running == 1)
> + 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.
> */
> @@ -2748,7 +2755,7 @@ select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flags)
> if (cpu == prev_cpu || wake_affine(affine_sd, p, sync))
> prev_cpu = cpu;
>
> - new_cpu = select_idle_sibling(p, prev_cpu);
> + new_cpu = select_idle_sibling(p, prev_cpu, sync);
> goto unlock;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC/PATCH] sched: Honor sync wake up in select_idle_sibling
2012-08-10 8:14 ` Mike Galbraith
@ 2012-08-10 8:51 ` Namhyung Kim
0 siblings, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2012-08-10 8:51 UTC (permalink / raw)
To: Mike Galbraith
Cc: Ingo Molnar, Peter Zijlstra, LKML, Namhyung Kim, Suresh Siddha
Hi, Mike
On Fri, 10 Aug 2012 10:14:44 +0200, Mike Galbraith wrote:
> On Fri, 2012-08-10 at 16:25 +0900, Namhyung Kim wrote:
>> From: Namhyung Kim <namhyung.kim@lge.com>
>>
>> When sync wakeup happens and there's the waker task running alone,
>> select the target cpu as if it's already idle.
>
> Ouch. That defeats the purpose of select_idle_sibling(). Just because
> we're doing a sync wakeup does not mean there's no convertible overlap,
> nor that the waker is really really going to take a nap immediately. A
> lot of the places that benefit up to and including hugely from looking
> for an idle shared cache to wake to do sync wakeups.
Thanks for the explanation! I misunderstood the function ;)
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-08-10 8:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-10 7:25 [RFC/PATCH] sched: Honor sync wake up in select_idle_sibling Namhyung Kim
2012-08-10 8:14 ` Mike Galbraith
2012-08-10 8:51 ` Namhyung Kim
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.