lkml.org 
[lkml]   [2006]   [Oct]   [27]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateFri, 27 Oct 2006 06:47:12 +0200 (CEST)
FromMartin Tostrup Setek <>
SubjectRe: [PATCH: 2.6.18.1] 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 <martitse@ifi.uio.no>
>> 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 
fix).

If not, then the comments in taskstats.h are very confusing....
Martin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-10-27 04:51    [from the cache]
©2003-2008