From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
Shailabh Nagar <nagar1234@in.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
John stultz <johnstul@us.ibm.com>,
Thomas Gleixner <tglx@linutronix.de>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Roland McGrath <roland@redhat.com>,
linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: Re: [patch 4/4] taskstats: Export "cdata_acct" with taskstats
Date: Thu, 25 Nov 2010 22:27:21 +0530 [thread overview]
Message-ID: <20101125165721.GE3298@balbir.in.ibm.com> (raw)
In-Reply-To: <20101119201144.871656307@linux.vnet.ibm.com>
* Michael Holzheu <holzheu@linux.vnet.ibm.com> [2010-11-19 21:11:12]:
> From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
>
> With this patch the (full) cumulative CPU time is added to "struct taskstats".
> The CPU time is only returned for the thread group leader.
>
> Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
> ---
> include/linux/taskstats.h | 7 ++++++-
> kernel/tsacct.c | 7 +++++++
> 2 files changed, 13 insertions(+), 1 deletion(-)
>
> --- a/include/linux/taskstats.h
> +++ b/include/linux/taskstats.h
> @@ -33,7 +33,7 @@
> */
>
>
> -#define TASKSTATS_VERSION 7
> +#define TASKSTATS_VERSION 8
> #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
> * in linux/sched.h */
>
> @@ -163,6 +163,11 @@ struct taskstats {
> /* Delay waiting for memory reclaim */
> __u64 freepages_count;
> __u64 freepages_delay_total;
> + /* version 7 ends here */
> +
> + /* All cumulative CPU time of dead children */
> + __u64 ac_cutime_acct; /* User CPU time [usec] */
> + __u64 ac_cstime_acct; /* System CPU time [usec] */
> };
>
>
> --- a/kernel/tsacct.c
> +++ b/kernel/tsacct.c
> @@ -31,6 +31,7 @@ void bacct_add_tsk(struct taskstats *sta
> const struct cred *tcred;
> struct timespec uptime, ts;
> u64 ac_etime;
> + unsigned long flags;
>
> BUILD_BUG_ON(TS_COMM_LEN < TASK_COMM_LEN);
>
> @@ -71,6 +72,12 @@ void bacct_add_tsk(struct taskstats *sta
> stats->ac_majflt = tsk->maj_flt;
>
> strncpy(stats->ac_comm, tsk->comm, sizeof(stats->ac_comm));
> + if (tsk->tgid == tsk->pid && lock_task_sighand(tsk, &flags)) {
I don't think referring to tgid and pid is a good idea in the context
of namespaces, thread_group_leader makes more sense like Oleg pointed
out.
> + struct cdata *cd = &tsk->signal->cdata_acct;
> + stats->ac_cutime_acct = cputime_to_usecs(cd->utime);
> + stats->ac_cstime_acct = cputime_to_usecs(cd->stime);
> + unlock_task_sighand(tsk, &flags);
> + }
> }
>
>
>
--
Three Cheers,
Balbir
next prev parent reply other threads:[~2010-11-25 16:57 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-19 20:11 [patch 0/4] taskstats: Improve cumulative time accounting Michael Holzheu
2010-11-19 20:11 ` [patch 1/4] taskstats: Introduce "struct cdata" Michael Holzheu
2010-11-25 12:29 ` Balbir Singh
2010-11-25 14:23 ` Oleg Nesterov
2010-11-25 16:38 ` Michael Holzheu
2010-11-19 20:11 ` [patch 2/4] taskstats: Introduce __account_cdata() function Michael Holzheu
2010-11-19 20:11 ` [patch 3/4] taskstats: Introduce cdata_acct for complete cumulative accounting Michael Holzheu
2010-11-23 16:59 ` Oleg Nesterov
2010-11-25 9:40 ` Michael Holzheu
2010-11-25 13:21 ` Oleg Nesterov
2010-11-25 17:45 ` Michael Holzheu
2010-11-19 20:11 ` [patch 4/4] taskstats: Export "cdata_acct" with taskstats Michael Holzheu
2010-11-25 13:26 ` Oleg Nesterov
2010-11-25 17:21 ` Michael Holzheu
2010-11-29 16:43 ` Oleg Nesterov
2010-11-29 16:58 ` Michael Holzheu
2010-11-29 18:08 ` Oleg Nesterov
2010-11-25 16:57 ` Balbir Singh [this message]
2010-11-19 20:19 ` [patch 0/4] taskstats: Improve cumulative time accounting Peter Zijlstra
2010-11-20 15:17 ` Oleg Nesterov
2010-11-22 7:21 ` Balbir Singh
2010-11-22 11:03 ` Michael Holzheu
2010-11-22 12:47 ` Michael Holzheu
2010-11-22 18:11 ` Valdis.Kletnieks
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=20101125165721.GE3298@balbir.in.ibm.com \
--to=balbir@linux.vnet.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=holzheu@linux.vnet.ibm.com \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nagar1234@in.ibm.com \
--cc=oleg@redhat.com \
--cc=roland@redhat.com \
--cc=schwidefsky@de.ibm.com \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®