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

2012年(3)

2011年(10)

2010年(100)

2009年(10)

我的朋友

分类: LINUX

2010-09-06 15:39:43

KERNEL VERSION:LINUX-2.6.34

[ loadbalance() > find_busiest_queue() ]
find_busiest_queue - find the busiest runqueue among the cpus in group.

static struct rq *
find_busiest_queue(struct sched_group *group, enum cpu_idle_type idle, unsigned long imbalance, const struct cpumask *cpus)
{
    struct rq *busiest = NULL, *rq;
    unsigned long max_load = 0;
    int i;

    for_each_cpu(i, sched_group_cpus(group)) {
        unsigned long power = power_of(i);
        unsigned long capacity = DIV_ROUND_CLOSEST(power, SCHED_LOAD_SCALE);
        unsigned long wl;

        if (!cpumask_test_cpu(i, cpus))
            continue;

        rq = cpu_rq(i);
        wl = weighted_cpuload(i);

        /*
         * When comparing with imbalance, use weighted_cpuload()
         * which is not scaled with the cpu power.
         */

        if (capacity && rq->nr_running == 1 && wl > imbalance)
            continue;

        /*
         * For the load comparisons with the other cpu's, consider
         * the weighted_cpuload() scaled with the cpu power, so that
         * the load can be moved away from the cpu that is potentially
         * running at a lower capacity.
         */

        wl = (wl * SCHED_LOAD_SCALE) / power;

        if (wl > max_load) {
            max_load = wl;
            busiest = rq;
        }
    }

    return busiest;
}


阅读(972) | 评论(0) | 转发(0) |
0

上一篇:find_busiest_group详解

下一篇:move_tasks()详解

给主人留下些什么吧!~~