public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn@suse.de>
To: Mike Chan <mike@android.com>, menage@google.com
Cc: balbir@linux.vnet.ibm.com, dwalker@fifo99.com,
	cpufreq@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched: cpuacct: Track cpuusage for CPU frequencies
Date: Fri, 9 Apr 2010 11:47:32 +0200	[thread overview]
Message-ID: <201004091147.32505.trenn@suse.de> (raw)
In-Reply-To: <1270603319-28907-1-git-send-email-mike@android.com>

On Wednesday 07 April 2010 03:21:59 Mike Chan wrote:
> New file: cpuacct.cpufreq when CONFIG_CPU_FREQ_STATS is enabled.
> 
> cpuacct.cpufreq reports the CPU time (nanoseconds) spent at each CPU frequency
> 
> Maximum number of frequencies supported is 32. As future architectures are
> added that support more than 32 frequency levels, CPUFREQ_TABLE_MAX in sched.c
> needs to be updated.
Why is accounting of each frequency needed?
pcc-cpufreq driver can do every frequency in a range and supports hundreds of
different frequencies, thus it does not depend on CPU_FREQ_TABLE.
Would the average frequency be enough to track/account?
This would avoid the static interface of listing each available freq.
It would also count "boosted" frequency case which is avail on most recent
X86 cpus.

> Signed-off-by: Mike Chan <mike@android.com>
> ---
>  Documentation/cgroups/cpuacct.txt |    3 +
>  kernel/sched.c                    |  112 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 115 insertions(+), 0 deletions(-)
... 
>  static int cpuacct_populate(struct cgroup_subsys *ss, struct cgroup *cgrp)
> @@ -9031,6 +9132,17 @@ static void cpuacct_charge(struct task_struct *tsk, u64 cputime)
>  
>  	for (; ca; ca = ca->parent) {
>  		u64 *cpuusage = per_cpu_ptr(ca->cpuusage, cpu);
> +#ifdef CONFIG_CPU_FREQ_STAT
> +		struct cpufreq_table *cpufreq_table =
> +			per_cpu_ptr(ca->cpufreq_table, cpu);
> +
> +		if (cpufreq_index > CPUFREQ_TABLE_MAX)
> +			printk_once(KERN_WARNING "cpuacct_charge: "
> +					"cpufreq_index: %d exceeds max table "
> +					"size\n", cpufreq_index);
> +		else
> +			cpufreq_table->freq[cpufreq_index] += cputime;
> +#endif
Can the frequency change somewhere in the middle between cpuacct_charge is
called?
What guarantees that the task run at cpufreq_table->freq[cpufreq_index]
all the time?

     Thomas

>  		*cpuusage += cputime;
>  	}
>  
> -- 

  reply	other threads:[~2010-04-09  9:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-07  1:21 [PATCH] sched: cpuacct: Track cpuusage for CPU frequencies Mike Chan
2010-04-09  9:47 ` Thomas Renninger [this message]
2010-04-09 20:50   ` Mike Chan
2010-04-12 20:03     ` Thomas Renninger
2010-04-12 22:01       ` Mike Chan

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=201004091147.32505.trenn@suse.de \
    --to=trenn@suse.de \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=dwalker@fifo99.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menage@google.com \
    --cc=mike@android.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