All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/core: Fix wrong burst unit in cgroup2 cpu.max write
@ 2021-09-10 16:25 ` Kailun Qin
  0 siblings, 0 replies; 5+ messages in thread
From: Kailun Qin @ 2021-09-10 16:25 UTC (permalink / raw)
  To: tj, bsegall, linux-kernel
  Cc: cgroups, changhuaixin, mingo, peterz, juri.lelli,
	vincent.guittot, Kailun Qin

In cpu_max_write(), as the eventual tg_set_cfs_bandwidth() operates on
the burst in nsec which is input from tg_get_cfs_burst() in usec, it
should be converted into nsec accordingly.

If not, this may cause a write into cgroup2 cpu.max to unexpectedly
change an already set cpu.max.burst.

This patch addresses the above issue.

Signed-off-by: Kailun Qin <kailun.qin@intel.com>
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index c4462c454ab9..fc9fcc56149f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10711,7 +10711,7 @@ static ssize_t cpu_max_write(struct kernfs_open_file *of,
 {
 	struct task_group *tg = css_tg(of_css(of));
 	u64 period = tg_get_cfs_period(tg);
-	u64 burst = tg_get_cfs_burst(tg);
+	u64 burst = (u64)tg_get_cfs_burst(tg) * NSEC_PER_USEC;
 	u64 quota;
 	int ret;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] sched/core: Fix wrong burst unit in cgroup2 cpu.max write
@ 2021-09-10 16:06 Kailun Qin
  0 siblings, 0 replies; 5+ messages in thread
From: Kailun Qin @ 2021-09-10 16:06 UTC (permalink / raw)
  To: tj-DgEjT+Ai2ygdnm+yROfE0A, bsegall-hpIqsD4AKlfQT0dZR+AlfA
  Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
	changhuaixin-KPsoFbNs7GizrGE5bRqYAgC/G2K4zDHf,
	mingo-H+wXaHxf7aLQT0dZR+AlfA, peterz-wEGCiKHe2LqWVfeAwA7xHQ,
	juri.lelli-H+wXaHxf7aLQT0dZR+AlfA,
	vincent.guittot-QSEj5FYQhm4dnm+yROfE0A, Kailun Qin

In cpu_max_write(), as the eventual tg_set_cfs_bandwidth() operates on
the burst in nsec which is input from tg_get_cfs_burst() in usec, it
should be converted into nsec accordingly.

If not, this may cause a write into cgroup2 cpu.max to unexpectedly
change an already set cpu.max.burst.

This patch addresses the above issue.

Signed-off-by: Kailun Qin <kailun.qin-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index c4462c454ab9..fc9fcc56149f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10711,7 +10711,7 @@ static ssize_t cpu_max_write(struct kernfs_open_file *of,
 {
 	struct task_group *tg = css_tg(of_css(of));
 	u64 period = tg_get_cfs_period(tg);
-	u64 burst = tg_get_cfs_burst(tg);
+	u64 burst = (u64)tg_get_cfs_burst(tg) * NSEC_PER_USEC;
 	u64 quota;
 	int ret;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-10 20:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10 16:25 [PATCH] sched/core: Fix wrong burst unit in cgroup2 cpu.max write Kailun Qin
2021-09-10 16:25 ` Kailun Qin
2021-09-10 20:43 ` Benjamin Segall
2021-09-10 20:43   ` Benjamin Segall
  -- strict thread matches above, loose matches on Subject: below --
2021-09-10 16:06 Kailun Qin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.