【内核调度、EAS】【cpu boost和task boost的区别和联系】

cpu boost

unsigned long
boosted_cpu_util(int cpu, unsigned long util)
{
	long margin;

	margin = schedtune_cpu_margin(util, cpu);

	trace_sched_boost_cpu(cpu, util, margin);

	return util + margin;
}

task的boost=util+margin

static inline int
schedtune_cpu_margin(unsigned long util, int cpu)
{
	int boost = schedtune_cpu_boost(cpu);

	if (boost == 0)
		return 0;

	return schedtune_margin(util, boost);
}

schedtune_margin详见,可以视为对util进行等比列的缩放

https://blog.youkuaiyun.com/feifei_csdn/article/details/107108542

int schedtune_cpu_boost(int cpu)
{
	struct boost_groups *bg;
	u64 now;

	bg = &per_cpu(cpu_boost_groups, cpu);
	now = sched_clock_cpu(cpu);

	/* Check to see if we have a hold in effect */
	if (schedtune_boost_timeout(now, bg->boost_ts))
		schedtune_cpu_update(cpu, now);

	return bg->boost_max;
}

task boost

static inline unsigned long
boosted_task_util(struct task_struct *task)
{
	unsigned long util = task_util_est(task);//这里我们假设walt机制是open的
	long margin = schedtune_task_margin(task);//margin就是sign除以100
 
	trace_sched_boost_task(task, util, margin);//添加到内核trace log里面
 
	return util + margin;
}

boost = util+margin

static inline long
schedtune_task_margin(struct task_struct *task)
{
	int boost = schedtune_task_boost(task);//返回的应该是我们设置的值-100到100
	unsigned long util;
	long margin;
 
	if (boost == 0)
		return 0;
 
	util = task_util_est(task);
	margin = schedtune_margin(util, boost);//对util进行一定的缩放
 
	return margin;
}
int schedtune_task_boost(struct task_struct *p)
{
	struct schedtune *st;
	int task_boost;

	if (unlikely(!schedtune_initialized))
		return 0;

	/* Get task boost value */
	rcu_read_lock();
	st = task_schedtune(p);
	task_boost = st->boost;
	rcu_read_unlock();

	return task_boost;
}

总结

schedtune boost接口在/dev/stune里面,一般只在forground和top-app里面配置

上面接口的初始值一般在init.rc里面配置,或者根据系统状态动态配置这些参数,都是可以影响task行为的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值