Re: [patch 3/4] taskstats: Introduce cdata_acct for completecumulative accounting

From: Michael Holzheu
Date: Thu Nov 25 2010 - 12:46:09 EST


On Thu, 2010-11-25 at 14:21 +0100, Oleg Nesterov wrote:
> On 11/25, Michael Holzheu wrote:
> But in fact this reminds we should cleanup this code somehow.
> By the time we call thread_group_times() there are no other
> threads.

Couldn't we just replace thread_group_times() with the following:

--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -101,12 +101,13 @@ static void __account_cdata(struct task_
* group, which consolidates times for all threads in the
* group including the group leader.
*/
- thread_group_times(p, &tgutime, &tgstime);
pcd = &p->real_parent->signal->cdata_wait;
tcd = &p->signal->cdata_threads;
cd = &p->signal->cdata_wait;

spin_lock_irqsave(&p->real_parent->sighand->siglock, flags);
+ tgutime = cputime_add(tcd->utime, p->utime);
+ tgstime = cputime_add(tcd->stime, p->stime);
pcd->utime =
cputime_add(pcd->utime,
cputime_add(tgutime,

Then we can move the __account_cdata() invocation down to the second
group_dead check.

Michael

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/