lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKfTPtAeHeTKnbfE160ChxpVDK5FAS8SHn8TSFMpSWNQrizPVg@mail.gmail.com>
Date: Thu, 2 May 2024 10:57:01 +0200
From: Vincent Guittot <vincent.guittot@...aro.org>
To: Cheng Yu <serein.chengyu@...wei.com>
Cc: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com, 
	dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com, 
	mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com, 
	changhuaixin@...ux.alibaba.com, shanpeic@...ux.alibaba.com, 
	dtcccc@...ux.alibaba.com, tj@...nel.org, linux-kernel@...r.kernel.org, 
	zhangqiao22@...wei.com, judy.chenhui@...wei.com, yusongping@...wei.com
Subject: Re: [PATCH] sched/core: fix incorrect parameter burst in cpu_max_write()

On Wed, 24 Apr 2024 at 15:29, Cheng Yu <serein.chengyu@...wei.com> wrote:
>
> In the cgroup v2 cpu subsystem, assuming we have a
> cgroup named test, we set cpu.max and cpu.max.burst:
>     # echo 1000000 > /sys/fs/cgroup/test/cpu.max
>     # echo 1000000 > /sys/fs/cgroup/test/cpu.max.burst
> then we check cpu.max and cpu.max.burst:
>     # cat /sys/fs/cgroup/test/cpu.max
>     1000000 100000
>     # cat /sys/fs/cgroup/test/cpu.max.burst
>     1000000
>
> Next we set cpu.max again and check cpu.max and
> cpu.max.burst:
>     # echo 2000000 > /sys/fs/cgroup/test/cpu.max
>     # cat /sys/fs/cgroup/test/cpu.max
>     2000000 100000
>     # cat /sys/fs/cgroup/test/cpu.max.burst
>     1000
> we found that the cpu.max.burst value changed unexpectedly.
>
> In cpu_max_write(), the unit of the burst value returned
> by tg_get_cfs_burst() is microseconds, while in cpu_max_write(),
> the burst unit used for calculation should be nanoseconds,
> which leads to the bug.
>
> To fix it, we get the burst value directly from
> tg->cfs_bandwidth.burst.
>
> Reported-by: Qixin Liao <liaoqixin@...wei.com>
> Fixes: f4183717b370 ("sched/fair: Introduce the burstable CFS controller")
> Signed-off-by: Cheng Yu <serein.chengyu@...wei.com>
> Signed-off-by: Zhang Qiao <zhangqiao22@...wei.com>

Reviewed-by: Vincent Guittot <vincent.guittot@...aro.org>
Tested-by: Vincent Guittot <vincent.guittot@...aro.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 7019a40457a6..d211d40a2edc 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -11402,7 +11402,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 = tg->cfs_bandwidth.burst;
>         u64 quota;
>         int ret;
>
> --
> 2.25.1
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ