mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Josh Don <joshdon@google.com>, Tejun Heo <tj@kernel.org>,
	Zefan Li <lizefan.x@bytedance.com>,
	Johannes Weiner <hannes@cmpxchg.org>
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cgroup: fix display of forceidle time at root
Date: Wed, 15 Mar 2023 22:19:10 -0400	[thread overview]
Message-ID: <bfbdef64-1b8c-4168-2576-f6d4a112686b@redhat.com> (raw)
In-Reply-To: <20230315214029.899573-1-joshdon@google.com>

On 3/15/23 17:40, Josh Don wrote:
> We need to reset forceidle_sum to 0 when reading from root, since the
> bstat we accumulate into is stack allocated.
>
> To make this more robust, just replace the existing cputime reset with a
> memset of the overall bstat.
>
> Signed-off-by: Josh Don <joshdon@google.com>
> ---
>   kernel/cgroup/rstat.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c
> index 831f1f472bb8..0a2b4967e333 100644
> --- a/kernel/cgroup/rstat.c
> +++ b/kernel/cgroup/rstat.c
> @@ -457,9 +457,7 @@ static void root_cgroup_cputime(struct cgroup_base_stat *bstat)
>   	struct task_cputime *cputime = &bstat->cputime;
>   	int i;
>   
> -	cputime->stime = 0;
> -	cputime->utime = 0;
> -	cputime->sum_exec_runtime = 0;
> +	memset(bstat, 0, sizeof(*bstat));
>   	for_each_possible_cpu(i) {
>   		struct kernel_cpustat kcpustat;
>   		u64 *cpustat = kcpustat.cpustat;

How about adding the following fixes tag?

Fixes: 1fcf54deb767 ("sched/core: add forced idle accounting for cgroups")

Cheers,
Longman


  reply	other threads:[~2023-03-16  2:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 21:40 Josh Don
2023-03-16  2:19 ` Waiman Long [this message]
2023-03-16 18:52   ` Josh Don
2023-03-17 22:20 ` Tejun Heo

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=bfbdef64-1b8c-4168-2576-f6d4a112686b@redhat.com \
    --to=longman@redhat.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=joshdon@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=tj@kernel.org \
    /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®