Re: [PATCH] Add all thread stats for TASKSTATS_CMD_ATTR_TGID

From: Guillaume Chazarain
Date: Sat Aug 25 2007 - 11:10:58 EST


Le Mon, 20 Aug 2007 22:31:08 +0530,
Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> a Ãcrit :

> > --- a/kernel/taskstats.c Sat Aug 18 17:15:17 2007 -0700
> > +++ b/kernel/taskstats.c Sun Aug 19 17:20:15 2007 +0200
> > @@ -246,6 +246,8 @@ static int fill_tgid(pid_t tgid, struct
> >
> > stats->nvcsw += tsk->nvcsw;
> > stats->nivcsw += tsk->nivcsw;
> > + bacct_add_tsk(stats, tsk);
> > + xacct_add_tsk(stats, tsk);
>
> I'm afraid this is still not good enough. bacct_add_tsk() will assign
> values and do nothing in the loop (HINT: no summation).

Hi Balbir, thank you for your review. I agree with everything you said
and am on my way to do it as time permits, but I have some trouble
understanding this part. You stated that bacct_add_tsk() would overwrite
the stats of each thread in the tgid stats, but the other part of the
patch is the (actually wrong) combination of stats in xxx_add_tsk()
using min/max/sum.

Also, I don't understand why the code to update btime:

/* calculate task elapsed time in timespec */
do_posix_clock_monotonic_gettime(&uptime);
ts = timespec_sub(uptime, tsk->start_time);
...
stats->ac_btime = get_seconds() - ts.tv_sec;

does not simply use tsk->start_time or tsk->real_start_time without
comparing it to the current time.

Thanks.

--
Guillaume
-
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/