From: Guillaume Chazarain <guichaz@yahoo.fr>
To: Andrew Morton <akpm@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Guillaume Chazarain <guichaz@yahoo.fr>,
Balbir Singh <balbir@in.ibm.com>, Jay Lan <jlan@engr.sgi.com>,
Jonathan Lim <jlim@sgi.com>, Oleg Nesterov <oleg@tv-sign.ru>
Subject: [PATCH 6/8] taskstats: tell fill_threadgroup_stats() if it replies with PID or TGID stats
Date: Wed, 26 Sep 2007 19:08:44 +0200 [thread overview]
Message-ID: <20070926170844.31221.95802.stgit@cheypa.inria.fr> (raw)
In-Reply-To: <20070926170818.31221.33994.stgit@cheypa.inria.fr>
fill_threadgroup_stats() may want to know if it is filling
TASKSTATS_CMD_ATTR_TGID or TASKSTATS_CMD_ATTR_PID stats, so give it this
information in the tg_stats boolean.
Signed-off-by: Guillaume Chazarain <guichaz@yahoo.fr>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Jay Lan <jlan@engr.sgi.com>
Cc: Jonathan Lim <jlim@sgi.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
---
include/linux/tsacct_kern.h | 4 ++--
kernel/taskstats.c | 11 ++++++-----
kernel/tsacct.c | 3 ++-
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/include/linux/tsacct_kern.h b/include/linux/tsacct_kern.h
index 1568a3d..e8d1ad6 100644
--- a/include/linux/tsacct_kern.h
+++ b/include/linux/tsacct_kern.h
@@ -11,11 +11,11 @@
#ifdef CONFIG_TASKSTATS
void bacct_add_tsk(struct taskstats *stats, struct task_struct *task);
-void bacct_fill_threadgroup(struct taskstats *stats, struct task_struct *task);
+void bacct_fill_threadgroup(struct taskstats *stats, struct task_struct *task, bool tg_stats);
#else
static inline void bacct_add_tsk(struct taskstats *stats, struct task_struct *task)
{}
-static inline void bacct_fill_threadgroup(struct taskstats *stats, struct task_struct *task)
+static inline void bacct_fill_threadgroup(struct taskstats *stats, struct task_struct *task, bool tg_stats)
{}
#endif /* CONFIG_TASKSTATS */
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index f25bf03..59fe1d8 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -204,12 +204,13 @@ static void add_tsk_stats(struct taskstats *stats, struct task_struct *task)
* fill_threadgroup_stats - initialize some common stats for the thread group
* @stats: the taskstats to write into
* @task: the thread representing the whole group
+ * @tg_stats: whether in the end thread group stats are requested
*
* Will be called on the thread group leader if requesting stats for the whole
* thread group.
*/
static void fill_threadgroup_stats(struct taskstats *stats,
- struct task_struct *task)
+ struct task_struct *task, bool tg_stats)
{
/*
* Each accounting subsystem adds calls to its functions to initialize
@@ -221,7 +222,7 @@ static void fill_threadgroup_stats(struct taskstats *stats,
stats->version = TASKSTATS_VERSION;
/* fill in basic acct fields */
- bacct_fill_threadgroup(stats, task);
+ bacct_fill_threadgroup(stats, task, tg_stats);
/* fill in extended acct fields */
xacct_fill_threadgroup(stats, task);
@@ -244,7 +245,7 @@ static int fill_pid(pid_t pid, struct task_struct *tsk, struct taskstats *stats)
memset(stats, 0, sizeof(*stats));
add_tsk_stats(stats, tsk);
- fill_threadgroup_stats(stats, tsk);
+ fill_threadgroup_stats(stats, tsk, false);
/* Define err: label here if needed */
put_task_struct(tsk);
@@ -285,7 +286,7 @@ static int fill_tgid(pid_t tgid, struct task_struct *first,
add_tsk_stats(stats, tsk);
} while_each_thread(first, tsk);
- fill_threadgroup_stats(stats, first->group_leader);
+ fill_threadgroup_stats(stats, first->group_leader, true);
unlock_task_sighand(first, &flags);
rc = 0;
out:
@@ -541,7 +542,7 @@ void taskstats_exit(struct task_struct *tsk, int group_dead)
*/
memcpy(stats, tsk->signal->stats, sizeof(*stats));
- fill_threadgroup_stats(stats, tsk->group_leader);
+ fill_threadgroup_stats(stats, tsk->group_leader, true);
send:
send_cpu_listeners(rep_skb, listeners);
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 73b4c69..8c2f470 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -62,7 +62,8 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
stats->nivcsw += tsk->nivcsw;
}
-void bacct_fill_threadgroup(struct taskstats *stats, struct task_struct *tsk)
+void bacct_fill_threadgroup(struct taskstats *stats, struct task_struct *tsk,
+ bool tg_stats)
{
fill_wall_times(stats, tsk);
next prev parent reply other threads:[~2007-09-26 17:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-26 17:08 [PATCH 1/8] taskstats: fix indentation of long argument lists Guillaume Chazarain
2007-09-26 17:08 ` [PATCH 2/8] taskstats: split the basic accounting fields Guillaume Chazarain
2007-09-26 17:08 ` [PATCH 3/8] taskstats: split the extended " Guillaume Chazarain
2007-09-26 17:08 ` [PATCH 4/8] taskstats: separate PID/TGID stats producers to complete the TGID ones Guillaume Chazarain
2007-09-26 17:08 ` [PATCH 5/8] taskstats: factor out version and context switch accounting Guillaume Chazarain
2007-09-26 17:08 ` Guillaume Chazarain [this message]
2007-09-26 17:08 ` [PATCH 7/8] taskstats: fix stats->ac_exitcode to work on threads and use group_exit_code Guillaume Chazarain
2007-09-26 17:08 ` [PATCH 8/8] taskstats: avoid breaking binary compatibility between taskstats v6 and before Guillaume Chazarain
2007-09-26 17:12 ` [PATCH 1/8] taskstats: fix indentation of long argument lists Guillaume Chazarain
2007-09-26 20:01 ` Andrew Morton
2007-09-27 8:27 ` Balbir Singh
2007-09-27 8:39 ` Guillaume Chazarain
-- strict thread matches above, loose matches on Subject: below --
2007-09-26 16:28 Guillaume Chazarain
2007-09-26 16:28 ` [PATCH 6/8] taskstats: tell fill_threadgroup_stats() if it replies with PID or TGID stats Guillaume Chazarain
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=20070926170844.31221.95802.stgit@cheypa.inria.fr \
--to=guichaz@yahoo.fr \
--cc=akpm@linux-foundation.org \
--cc=balbir@in.ibm.com \
--cc=jlan@engr.sgi.com \
--cc=jlim@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
/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®