All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Cruz Zhao <CruzZhao@linux.alibaba.com>
Cc: lizefan.x@bytedance.com, hannes@cmpxchg.org, mingo@redhat.com,
	peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	bristot@redhat.com, joshdon@google.com, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] sched/core: Force idle accounting per cgroup
Date: Wed, 12 Jan 2022 10:42:22 -1000	[thread overview]
Message-ID: <Yd89Lv3VuaaFVm4h@slm.duckdns.org> (raw)
In-Reply-To: <1641894961-9241-4-git-send-email-CruzZhao@linux.alibaba.com>

Hello,

On Tue, Jan 11, 2022 at 05:56:01PM +0800, Cruz Zhao wrote:
> +#ifdef CONFIG_SCHED_CORE
> +void cpuacct_account_forceidle(int cpu, struct task_struct *tsk, u64 cputime)
> +{
> +	struct cpuacct *ca;
> +	u64 *fi;
> +
> +	rcu_read_lock();
> +	/*
> +	 * We have hold rq->core->__lock here, which protects ca->forceidle
> +	 * percpu.
> +	 */
> +	for (ca = task_ca(tsk); ca; ca = parent_ca(ca)) {
> +		fi = per_cpu_ptr(ca->forceidle, cpu);
> +		*fi += cputime;
> +	}

Please don't do this. Use rstat and integrate it with other stats.

Thanks.

-- 
tejun

WARNING: multiple messages have this Message-ID (diff)
From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Cruz Zhao <CruzZhao-KPsoFbNs7GizrGE5bRqYAgC/G2K4zDHf@public.gmane.org>
Cc: lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org,
	hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org,
	mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
	juri.lelli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	dietmar.eggemann-5wv7dgnIgG8@public.gmane.org,
	rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org,
	bsegall-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	mgorman-l3A5Bk7waGM@public.gmane.org,
	bristot-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	joshdon-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 3/3] sched/core: Force idle accounting per cgroup
Date: Wed, 12 Jan 2022 10:42:22 -1000	[thread overview]
Message-ID: <Yd89Lv3VuaaFVm4h@slm.duckdns.org> (raw)
In-Reply-To: <1641894961-9241-4-git-send-email-CruzZhao-KPsoFbNs7GizrGE5bRqYAgC/G2K4zDHf@public.gmane.org>

Hello,

On Tue, Jan 11, 2022 at 05:56:01PM +0800, Cruz Zhao wrote:
> +#ifdef CONFIG_SCHED_CORE
> +void cpuacct_account_forceidle(int cpu, struct task_struct *tsk, u64 cputime)
> +{
> +	struct cpuacct *ca;
> +	u64 *fi;
> +
> +	rcu_read_lock();
> +	/*
> +	 * We have hold rq->core->__lock here, which protects ca->forceidle
> +	 * percpu.
> +	 */
> +	for (ca = task_ca(tsk); ca; ca = parent_ca(ca)) {
> +		fi = per_cpu_ptr(ca->forceidle, cpu);
> +		*fi += cputime;
> +	}

Please don't do this. Use rstat and integrate it with other stats.

Thanks.

-- 
tejun

  reply	other threads:[~2022-01-12 20:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11  9:55 [PATCH v2 0/3] Accounting forced idle time per cpu and per cgroup Cruz Zhao
2022-01-11  9:55 ` Cruz Zhao
2022-01-11  9:55 ` [PATCH v2 1/3] sched/core: Accounting forceidle time for all tasks except idle task Cruz Zhao
2022-01-11  9:55   ` Cruz Zhao
2022-01-11 23:52   ` Josh Don
2022-01-18 11:18   ` [tip: sched/urgent] " tip-bot2 for Cruz Zhao
2022-01-11  9:56 ` [PATCH v2 2/3] sched/core: Forced idle accounting per-cpu Cruz Zhao
2022-01-12  1:59   ` Josh Don
2022-01-12  1:59     ` Josh Don
2022-01-14 15:04     ` cruzzhao
2022-01-14 15:04       ` cruzzhao
2022-01-14 23:40       ` Josh Don
2022-01-14 23:40         ` Josh Don
2022-01-12 12:27   ` Peter Zijlstra
2022-01-12 12:27     ` Peter Zijlstra
2022-01-14 11:06     ` cruzzhao
2022-01-11  9:56 ` [PATCH v2 3/3] sched/core: Force idle accounting per cgroup Cruz Zhao
2022-01-11  9:56   ` Cruz Zhao
2022-01-12 20:42   ` Tejun Heo [this message]
2022-01-12 20:42     ` Tejun Heo
2022-01-14 11:13     ` cruzzhao
2022-01-14 11:13       ` cruzzhao
2022-01-14 16:39       ` Tejun Heo
2022-01-14 16:39         ` Tejun Heo
2022-01-12 21:27   ` kernel test robot

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=Yd89Lv3VuaaFVm4h@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=CruzZhao@linux.alibaba.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=joshdon@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.