Unverified Commit c3df1656 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!7474 sched/fair: set burst to zero when cfs bandwidth is cancelled

Merge Pull Request from: @ci-robot 
 
PR sync from: Cheng Yu <serein.chengyu@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/MOVIOBTN4OGUGYVGH46WGDH4CPPOFCXU/ 
sched/fair: set burst to zero when cfs bandwidth is cancelled

Cheng Yu (1):
  sched/fair: set burst to zero when set max to cpu.max

Zhao Wenhui (1):
  sched/fair: limit burst to zero when cfs bandwidth is toggled off


-- 
2.25.1
 
https://gitee.com/openeuler/kernel/issues/I9PR8C 
 
Link:https://gitee.com/openeuler/kernel/pulls/7474

 

Reviewed-by: default avatarZhang Peng <zhangpeng362@huawei.com>
Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents 40fbfec2 743f71fc
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -11051,6 +11051,12 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota,
				     burst + quota > max_cfs_runtime))
		return -EINVAL;

	/*
	 * Ensure burst equals to zero when quota is -1.
	 */
	if (quota == RUNTIME_INF && burst)
		return -EINVAL;

	/*
	 * Prevent race between setting of cfs_rq->runtime_enabled and
	 * unthrottle_offline_cfs_rqs().
@@ -11110,8 +11116,10 @@ static int tg_set_cfs_quota(struct task_group *tg, long cfs_quota_us)

	period = ktime_to_ns(tg->cfs_bandwidth.period);
	burst = tg->cfs_bandwidth.burst;
	if (cfs_quota_us < 0)
	if (cfs_quota_us < 0) {
		quota = RUNTIME_INF;
		burst = 0;
	}
	else if ((u64)cfs_quota_us <= U64_MAX / NSEC_PER_USEC)
		quota = (u64)cfs_quota_us * NSEC_PER_USEC;
	else
@@ -12052,8 +12060,11 @@ static ssize_t cpu_max_write(struct kernfs_open_file *of,
	int ret;

	ret = cpu_period_quota_parse(buf, &period, &quota);
	if (!ret)
	if (!ret) {
		if (quota == RUNTIME_INF)
			burst = 0;
		ret = tg_set_cfs_bandwidth(tg, period, quota, burst);
	}
	return ret ?: nbytes;
}
#endif