linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Josh Don <joshdon@google.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Tejun Heo <tj@kernel.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Valentin Schneider <vschneid@redhat.com>,
	linux-kernel@vger.kernel.org,
	Cruz Zhao <CruzZhao@linux.alibaba.com>
Subject: Re: [PATCH v2] sched/core: add forced idle accounting for cgroups
Date: Sat, 21 May 2022 12:00:37 +0200	[thread overview]
Message-ID: <20220521100037.GA2578@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20220520235138.3140590-1-joshdon@google.com>

On Fri, May 20, 2022 at 04:51:38PM -0700, Josh Don wrote:

> diff --git a/kernel/sched/core_sched.c b/kernel/sched/core_sched.c
> index 38a2cec21014..ddef2b8ddf68 100644
> --- a/kernel/sched/core_sched.c
> +++ b/kernel/sched/core_sched.c
> @@ -277,7 +277,11 @@ void __sched_core_account_forceidle(struct rq *rq)
>  		if (p == rq_i->idle)
>  			continue;
>  
> -		__schedstat_add(p->stats.core_forceidle_sum, delta);
> +		/*
> +		 * Note: this will account forceidle to the current cpu, even
> +		 * if it comes from our SMT sibling.
> +		 */
> +		account_forceidle_time(p, delta);
>  	}

AFAICT this is the only caller of that function.

>  }
>  
> diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
> index 78a233d43757..598d1026d629 100644
> --- a/kernel/sched/cputime.c
> +++ b/kernel/sched/cputime.c
> @@ -226,6 +226,17 @@ void account_idle_time(u64 cputime)
>  		cpustat[CPUTIME_IDLE] += cputime;
>  }
>  
> +
> +#ifdef CONFIG_SCHED_CORE
> +/* Account for forceidle time due to core scheduling. */
> +void account_forceidle_time(struct task_struct *p, u64 delta)
> +{
> +	schedstat_add(p->stats.core_forceidle_sum, delta);

But then you loose the __, why? 

> +
> +	task_group_account_field(p, CPUTIME_FORCEIDLE, delta);
> +}
> +#endif

  parent reply	other threads:[~2022-05-21 10:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-20 23:51 [PATCH v2] sched/core: add forced idle accounting for cgroups Josh Don
2022-05-21  1:31 ` kernel test robot
2022-05-21  2:38 ` kernel test robot
2022-05-21  3:19 ` kernel test robot
2022-05-21 10:00 ` Peter Zijlstra [this message]
2022-05-23 21:19   ` Josh Don
2022-05-23 11:27 ` Dan Carpenter
2022-05-23 21:20   ` Josh Don

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=20220521100037.GA2578@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=CruzZhao@linux.alibaba.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=joshdon@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@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;
as well as URLs for NNTP newsgroup(s).