delayacct: cpu_count in taskstats updated correctly
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 22 lines
Begin forwarded message:
Date: Fri, 27 Oct 2006 05:18:17 +0200 (CEST)
From: Martin Tostrup Setek <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH: 2.6.18.1] delayacct:cpu_countin taskstats updated correctlyfrom: Martin T. Setek <[email protected]>
cpu_countin struct taskstats should be the same as the corresponding (third) value found in /proc/<pid>/schedstatSigned-off-by <[email protected]>---
Index:linux-2.6.18.1/kernel/delayacct.c
===================================================================
kernel/delayacct.c int __delayacct_add_tsk(struct taskstats
Quoted 9 lines
kernel/delayacct.c +1
-2@@ -124,7 +124,7 @@ int __delayacct_add_tsk(struct taskstats t2 = tsk->sched_info.run_delay; t3 = tsk->sched_info.cpu_time; - d->cpu_count += t1; + d->cpu_count = t1;jiffies_to_timespec (t2, &ts); tmp = (s64 )d->cpu_delay_total +timespec_to_ns (&ts); -
I was off from work and just saw this message.
The first field "d" in __delayacct_add_task() acts as an accumulator of statistics (specially useful for fill_tgid() and called just once for fill_pid() with cpu_count of "d" initialized to 0).
We sum up in d->cpu_count, since the same value of "d" is passed each time from fill_tgid(). The proposed change is incorrect as we would overwrite the value each time.
Balbir
Signature · 3 lines
Balbir Singh, Linux Technology Center, IBM Software Labs