• G
    sched: fix __load_balance_iterator() for cfq with only one task · 38736f47
    Gautham R Shenoy 提交于
    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.
    Signed-off-by: NGautham R Shenoy <ego@in.ibm.com>
    Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
    Signed-off-by: NIngo Molnar <mingo@elte.hu>
    38736f47
sched_fair.c 40.7 KB