[lkml]   [2006]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH:] delayacct: cpu_count in taskstats updated correctly
On Thu, 26 Oct 2006, David Rientjes wrote:
> On Fri, 27 Oct 2006, Martin Tostrup Setek wrote:
>> from: Martin T. Setek <>
>> cpu_count in struct taskstats should be the same as the corresponding (third)
>> value found in /proc/<pid>/schedstat
> I disagree in favor of Documentation/accounting/taskstats-struct.txt.
> cpu_count is the number of delay values recorded, so accumulating them is
> appropriate.

Perhaps I'm mistaken, but the code accumulates the value it
finds in sched_info.pcnt in the task_struct. Now, in sched.h I found this:

struct sched_info {
/* cumulative counters */
unsigned long cpu_time, /* time spent on the cpu */
run_delay, /* time spent waiting on a runqueue */
pcnt; /* # of timeslices run on this cpu */

The comment says that these counters are cumulative... The code that
updates them (sched.c: sched_info_arrive()), does accumulate them.

In include/linux/taskstats.h, I found:

* xxx_count is the number of delay values recorded
* xxx_delay_total is the corresponding cumulative delay in nanoseconds

I interpret these comments as saying that:

cpu_delay should be the total number of nanoseconds a task has been
waiting in a runqueue for a CPU, and cpu_count is equal to the number of
times the task got the CPU (or waited for it). If so, then the code
updates taskstats.cpu_delay_total incorrectly too (which my patch didn't

If not, then the comments in taskstats.h are very confusing....

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-10-27 06:51    [W:0.039 / U:47.632 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site