mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vincent Guittot <vincent.guittot@linaro.org>
To: Cheng Yu <serein.chengyu@huawei.com>
Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	 dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com,  mgorman@suse.de, bristot@redhat.com,
	vschneid@redhat.com,  changhuaixin@linux.alibaba.com,
	shanpeic@linux.alibaba.com,  dtcccc@linux.alibaba.com,
	tj@kernel.org, linux-kernel@vger.kernel.org,
	 zhangqiao22@huawei.com, judy.chenhui@huawei.com,
	yusongping@huawei.com
Subject: Re: [PATCH] sched/core: fix incorrect parameter burst in cpu_max_write()
Date: Thu, 2 May 2024 10:57:01 +0200	[thread overview]
Message-ID: <CAKfTPtAeHeTKnbfE160ChxpVDK5FAS8SHn8TSFMpSWNQrizPVg@mail.gmail.com> (raw)
In-Reply-To: <20240424132438.514720-1-serein.chengyu@huawei.com>

On Wed, 24 Apr 2024 at 15:29, Cheng Yu <serein.chengyu@huawei.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@huawei.com>
> Fixes: f4183717b370 ("sched/fair: Introduce the burstable CFS controller")
> Signed-off-by: Cheng Yu <serein.chengyu@huawei.com>
> Signed-off-by: Zhang Qiao <zhangqiao22@huawei.com>

Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Tested-by: Vincent Guittot <vincent.guittot@linaro.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
>
>

  reply	other threads:[~2024-05-02  8:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24 13:24 Cheng Yu
2024-05-02  8:57 ` Vincent Guittot [this message]
2024-05-17  8:06 ` [tip: sched/urgent] sched/core: Fix incorrect initialization of the 'burst' parameter " tip-bot2 for Cheng Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKfTPtAeHeTKnbfE160ChxpVDK5FAS8SHn8TSFMpSWNQrizPVg@mail.gmail.com \
    --to=vincent.guittot@linaro.org \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=changhuaixin@linux.alibaba.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=dtcccc@linux.alibaba.com \
    --cc=judy.chenhui@huawei.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=serein.chengyu@huawei.com \
    --cc=shanpeic@linux.alibaba.com \
    --cc=tj@kernel.org \
    --cc=vschneid@redhat.com \
    --cc=yusongping@huawei.com \
    --cc=zhangqiao22@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®