public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Chen Ridong <chenridong@huawei.com>
Cc: lizefan.x@bytedance.com, hannes@cmpxchg.org, longman@redhat.com,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] cgroup/rstat: add force idle show helper
Date: Mon, 1 Jul 2024 07:16:54 -1000	[thread overview]
Message-ID: <ZoLkhvoXZhoYLWsc@slm.duckdns.org> (raw)
In-Reply-To: <20240701140441.721997-1-chenridong@huawei.com>

Hello,

On Mon, Jul 01, 2024 at 02:04:41PM +0000, Chen Ridong wrote:
> +#ifdef CONFIG_SCHED_CORE
> +static void cgroup_force_idle_show(struct seq_file *seq, struct cgroup_base_stat bstat)

Please pass bstat as a pointer. We don't want to copy the whole thing on
stack.

> +{
> +	u64 forceidle_time = bstat.forceidle_sum;
> +
> +	do_div(forceidle_time, NSEC_PER_USEC);
> +	seq_printf(seq, "core_sched.force_idle_usec %llu\n", forceidle_time);
> +}
> +#endif

And maybe move #ifdef and #endif inside the function body so that we don't
need #ifdef in the caller?

>  void cgroup_base_stat_cputime_show(struct seq_file *seq)
>  {
>  	struct cgroup *cgrp = seq_css(seq)->cgroup;
>  	u64 usage, utime, stime;
>  	struct cgroup_base_stat bstat;
> -#ifdef CONFIG_SCHED_CORE
> -	u64 forceidle_time;
> -#endif
>  
>  	if (cgroup_parent(cgrp)) {
>  		cgroup_rstat_flush_hold(cgrp);
>  		usage = cgrp->bstat.cputime.sum_exec_runtime;
>  		cputime_adjust(&cgrp->bstat.cputime, &cgrp->prev_cputime,
>  			       &utime, &stime);
> -#ifdef CONFIG_SCHED_CORE
> -		forceidle_time = cgrp->bstat.forceidle_sum;
> -#endif
> +		stat = cgrp->bstat;

Where is @stat defined? Is the patch even compile tested?

Thanks.

-- 
tejun

      reply	other threads:[~2024-07-01 17:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01 14:04 [PATCH -next] cgroup/rstat: add force idle show helper Chen Ridong
2024-07-01 17:16 ` Tejun Heo [this message]

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=ZoLkhvoXZhoYLWsc@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=chenridong@huawei.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=longman@redhat.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