Messages in this thread | | | Subject | Re: [PATCH] sched: Fix __load_balance_iterator() for cfq with only one task | From | Peter Zijlstra <> | Date | Fri, 05 Sep 2008 17:13:48 +0200 |
| |
On Fri, 2008-09-05 at 18:00 +0530, Gautham R Shenoy wrote: > sched: Fix __load_balance_iterator() for cfq with only one task. > > From: Gautham R Shenoy <ego@in.ibm.com> > > The __load_balance_iterator() returns a NULL when there's only one > sched_entity which is a task. It is caused by the following code-path. > > > /* Skip over entities that are not tasks */ > do { > se = list_entry(next, struct sched_entity, group_node); > next = next->next; > } while (next != &cfs_rq->tasks && !entity_is_task(se)); > > if (next == &cfs_rq->tasks) > return NULL; > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > This will return NULL even when se is a task. > > As a side-effect, there was a regression in sched_mc behavior since 2.6.25, > since iter_move_one_task() when it calls load_balance_start_fair(), > would not get any tasks to move! > > Fix this by checking if the last entity was a task or not.
Gregory did a similar fix a while ago, but that caused grief of some kind..
Greg, can you recollect why we pulled it? I can't seem to find it.
Aside from that this patch looks fine..
> Signed-off-by: Gautham R Shenoy <ego@in.ibm.com> > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> > Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> > Cc: Ingo Molnar <mingo@elte.hu> > --- > > kernel/sched_fair.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > > diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c > index fb8994c..f1c96e3 100644 > --- a/kernel/sched_fair.c > +++ b/kernel/sched_fair.c > @@ -1451,7 +1451,7 @@ __load_balance_iterator(struct cfs_rq *cfs_rq, struct list_head *next) > next = next->next; > } while (next != &cfs_rq->tasks && !entity_is_task(se)); > > - if (next == &cfs_rq->tasks) > + if (next == &cfs_rq->tasks && !entity_is_task(se)) > return NULL; > > cfs_rq->balance_iterator = next;
| |