* [PATCH] sched: fix off-by-one bug in balance_tasks()
@ 2009-04-15 2:49 Miao Xie
2009-04-15 11:41 ` Peter Zijlstra
0 siblings, 1 reply; 3+ messages in thread
From: Miao Xie @ 2009-04-15 2:49 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra; +Cc: Linux-Kernel
If the load that need be moved equals the half weight of a task, I think
it is unnecessary to move this task. Or this task will be moved back and
forth.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
kernel/sched.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index 5724508..44926c8 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3085,7 +3085,7 @@ next:
if (!p || loops++ > sysctl_sched_nr_migrate)
goto out;
- if ((p->se.load.weight >> 1) > rem_load_move ||
+ if ((p->se.load.weight >> 1) >= rem_load_move ||
!can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
p = iterator->next(iterator->arg);
goto next;
--
1.6.0.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] sched: fix off-by-one bug in balance_tasks()
2009-04-15 2:49 [PATCH] sched: fix off-by-one bug in balance_tasks() Miao Xie
@ 2009-04-15 11:41 ` Peter Zijlstra
2009-04-16 1:23 ` Miao Xie
0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2009-04-15 11:41 UTC (permalink / raw)
To: miaox; +Cc: Ingo Molnar, Linux-Kernel
On Wed, 2009-04-15 at 10:49 +0800, Miao Xie wrote:
> If the load that need be moved equals the half weight of a task, I think
> it is unnecessary to move this task. Or this task will be moved back and
> forth.
That's actually desirable. Consider the 3 tasks on 2 cpus statically
infeasible scenario. There you'd want the tasks to bounce around a bit
in order to provide fairness.
> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
> ---
> kernel/sched.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/sched.c b/kernel/sched.c
> index 5724508..44926c8 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -3085,7 +3085,7 @@ next:
> if (!p || loops++ > sysctl_sched_nr_migrate)
> goto out;
>
> - if ((p->se.load.weight >> 1) > rem_load_move ||
> + if ((p->se.load.weight >> 1) >= rem_load_move ||
> !can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
> p = iterator->next(iterator->arg);
> goto next;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] sched: fix off-by-one bug in balance_tasks()
2009-04-15 11:41 ` Peter Zijlstra
@ 2009-04-16 1:23 ` Miao Xie
0 siblings, 0 replies; 3+ messages in thread
From: Miao Xie @ 2009-04-16 1:23 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: Ingo Molnar, Linux-Kernel
on 2009-4-15 19:41 Peter Zijlstra wrote:
> On Wed, 2009-04-15 at 10:49 +0800, Miao Xie wrote:
>> If the load that need be moved equals the half weight of a task, I think
>> it is unnecessary to move this task. Or this task will be moved back and
>> forth.
>
> That's actually desirable. Consider the 3 tasks on 2 cpus statically
> infeasible scenario. There you'd want the tasks to bounce around a bit
> in order to provide fairness.
I see. Thanks for your explanation.
Miao Xie
>
>> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
>> ---
>> kernel/sched.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/kernel/sched.c b/kernel/sched.c
>> index 5724508..44926c8 100644
>> --- a/kernel/sched.c
>> +++ b/kernel/sched.c
>> @@ -3085,7 +3085,7 @@ next:
>> if (!p || loops++ > sysctl_sched_nr_migrate)
>> goto out;
>>
>> - if ((p->se.load.weight >> 1) > rem_load_move ||
>> + if ((p->se.load.weight >> 1) >= rem_load_move ||
>> !can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
>> p = iterator->next(iterator->arg);
>> goto next;
>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-04-16 1:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-15 2:49 [PATCH] sched: fix off-by-one bug in balance_tasks() Miao Xie
2009-04-15 11:41 ` Peter Zijlstra
2009-04-16 1:23 ` Miao Xie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox