Chinaunix首页 | 论坛 | 博客
  • 博客访问: 429279
  • 博文数量: 123
  • 博客积分: 2686
  • 博客等级: 少校
  • 技术积分: 1349
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-23 22:11
文章分类
文章存档

2012年(3)

2011年(10)

2010年(100)

2009年(10)

我的朋友

分类: LINUX

2010-09-06 15:55:39

KERNEL VERSION: linux-2.6.34

[load_balance() > move_tasks()]

move_tasks tries to move up to max_load_move weighted load from busiest to this_rq, as part of a balancing operation within domain "sd".Returns 1 if successful and 0 otherwise.Called with both runqueues locked.
 

static int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest, unsigned long max_load_move, struct sched_domain *sd, enum cpu_idle_type idle, int *all_pinned)
{
    unsigned long total_load_moved = 0, load_moved;
    int this_best_prio = this_rq->curr->prio;

    do {
        load_moved = load_balance_fair(this_rq, this_cpu, busiest,
                max_load_move - total_load_moved,
                sd, idle, all_pinned, &this_best_prio);

        total_load_moved += load_moved;

#ifdef CONFIG_PREEMPT
        /*
         * NEWIDLE balancing is a source of latency, so preemptible
         * kernels will stop after the first task is pulled to minimize
         * the critical section.
         */

        if (idle == CPU_NEWLY_IDLE && this_rq->nr_running)
            break;

        if (raw_spin_is_contended(&this_rq->lock) ||
                raw_spin_is_contended(&busiest->lock))
            break;
#endif
    } while (load_moved && max_load_move > total_load_moved);

    return total_load_moved > 0;
}


阅读(1084) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~