From: Oleg Nesterov <oleg@tv-sign.ru>
To: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Guillaume Chazarain <guichaz@yahoo.fr>,
Jonathan Lim <jlim@sgi.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Jay Lan <jlan@cthulhu.engr.sgi.com>,
Michael Neuling <mikey@neuling.org>
Subject: Re: Add all thread stats for TASKSTATS_CMD_ATTR_TGID (v5)
Date: Thu, 20 Sep 2007 16:16:01 +0400 [thread overview]
Message-ID: <20070920121601.GA135@tv-sign.ru> (raw)
In-Reply-To: <46F23550.6050209@linux.vnet.ibm.com>
On 09/20, Balbir Singh wrote:
>
> Andrew Morton wrote:
> > On Tue, 18 Sep 2007 00:23:39 +0200 Guillaume Chazarain <guichaz@yahoo.fr> wrote:
> >
> >> TASKSTATS_CMD_ATTR_TGID used to return only the delay accounting stats, not
> >> the basic and extended accounting. With this patch,
> >> TASKSTATS_CMD_ATTR_TGID also aggregates the accounting info for all threads
> >> of a thread group. This makes TASKSTATS_CMD_ATTR_TGID usable in a similar
> >> fashion to TASKSTATS_CMD_ATTR_PID, for commands like iotop -P
> >> (http://guichaz.free.fr/misc/iotop.py).
> >
> > This patch conflicts somewhat with
> > add-scaled-time-to-taskstats-based-process-accounting.patch
> >
> > I fixed it up like this:
> >
> > void bacct_add_tsk(struct taskstats *stats, struct task_struct *task)
> > {
> > if (task->flags & PF_SUPERPRIV)
> > stats->ac_flag |= ASU;
> > if (task->flags & PF_DUMPCORE)
> > stats->ac_flag |= ACORE;
> > if (task->flags & PF_SIGNALED)
> > stats->ac_flag |= AXSIG;
> > if (thread_group_leader(task) && (task->flags & PF_FORKNOEXEC))
> > /*
> > * Threads are created by do_fork() and don't exec but not in
> > * the AFORK sense, as the latter involves fork(2).
> > */
> > stats->ac_flag |= AFORK;
> >
> > stats->ac_utimescaled +=
> > cputime_to_msecs(task->utimescaled) * USEC_PER_MSEC;
> > stats->ac_stimescaled +=
> > cputime_to_msecs(task->stimescaled) * USEC_PER_MSEC;
> > stats->ac_utime += cputime_to_msecs(task->utime) * USEC_PER_MSEC;
> > stats->ac_stime += cputime_to_msecs(task->stime) * USEC_PER_MSEC;
> > stats->ac_minflt += task->min_flt;
> > stats->ac_majflt += task->maj_flt;
> > }
> >
> > (note the s/=/+=/ in there) but it all needs reviewing and checking and
> > testing please.
>
> Andrew,
>
> Thanks for reviewing the patchset, this patch is on my review and test
> queue (which has gotten rather long of late). I'll test it further and
> get back.
I still think this version is very wrong. It makes the ->signal->stats
absolutely meaningless. Quoting myself:
On 09/18, Guillaume Chazarain wrote:
>
> @@ -508,7 +543,7 @@ void taskstats_exit(struct task_struct *
> if (!stats)
> goto err;
>
> - memcpy(stats, tsk->signal->stats, sizeof(*stats));
> + fill_tgid(tsk->pid, tsk, stats);
No, no, this is wrong.
tsk->signal->stats contains the accumulated info about the already exited
threads, we shouldn't throw it out.
Also, fill_tgid() doesn't make sense here, current is the last live sub-thread.
Oleg.
next prev parent reply other threads:[~2007-09-20 12:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-02 13:53 [PATCH] Add all thread stats for TASKSTATS_CMD_ATTR_TGID Guillaume Chazarain
2007-08-02 19:04 ` Andrew Morton
2007-08-19 19:34 ` Guillaume Chazarain
2007-08-20 17:01 ` Balbir Singh
2007-08-25 15:10 ` Guillaume Chazarain
2007-08-26 4:58 ` Balbir Singh
2007-08-26 9:44 ` Guillaume Chazarain
2007-08-31 3:02 ` Jonathan Lim
2007-08-31 7:24 ` Balbir Singh
2007-08-31 12:35 ` Add all thread stats for TASKSTATS_CMD_ATTR_TGID (v3) Guillaume Chazarain
2007-09-13 0:18 ` Andrew Morton
2007-09-15 18:42 ` Add all thread stats for TASKSTATS_CMD_ATTR_TGID (v4) Guillaume Chazarain
2007-09-17 22:23 ` Add all thread stats for TASKSTATS_CMD_ATTR_TGID (v5) Guillaume Chazarain
2007-09-18 15:29 ` Oleg Nesterov
2007-09-20 6:20 ` Andrew Morton
2007-09-20 8:54 ` Balbir Singh
2007-09-20 12:16 ` Oleg Nesterov [this message]
2007-09-20 12:17 ` Balbir Singh
2007-09-07 23:37 ` [PATCH] Add all thread stats for TASKSTATS_CMD_ATTR_TGID Jonathan Lim
2007-09-10 13:03 ` Guillaume Chazarain
2007-08-15 7:15 ` Balbir Singh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070920121601.GA135@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=guichaz@yahoo.fr \
--cc=jlan@cthulhu.engr.sgi.com \
--cc=jlim@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mikey@neuling.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).