【内核调度、负载均衡】【find_busiest_group】

本文关注Linux内核调度中find_busiest_group函数的使用,该函数用于确定系统中最忙碌的任务组。文章介绍了group_type枚举类型,包括group_other、group_misfit_task、group_imbalanced和group_overloaded四个状态,并提到了初始化和更新调度器负载平衡统计的相关链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

find_busiest_group

enum group_type {
    group_other = 0,
    group_misfit_task,
    group_imbalanced,
    group_overloaded,
};

/**
 * find_busiest_group - Returns the busiest group within the sched_domain
 * if there is an imbalance(不平衡).
 *
 * Also calculates the amount of weighted load which should be moved
 * to restore(恢复) balance.
 *
 * @env: The load balancing environment.
 *
 * Return:	- The busiest group if imbalance exists.
 */
static struct sched_group *find_busiest_group(struct lb_env *env)
{
	struct sg_lb_stats *local, *busiest;
	struct sd_lb_stats sds;

	init_sd_lb_stats(&sds);

	/*
	 * Compute the various statistics relavent for load balancing at
	 * this level.
	 */
	 /* (7.3.1) 更新本层级sched_group链表中,每个sched_group的负载,
        并选出busiest的一个sched_group*/
	update_sd_lb_stats(env, &sds);

	
/* (7.3.2) 如果EAS使能,跨cluster的任务迁移使用EAS来做 */
	if (energy_aware() && !sd_overutilized(
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值