2010-11-11 17:08:21

by Michael Holzheu

[permalink] [raw]
Subject: [RFC][PATCH v2 3/7] taskstats: Add thread group ID to taskstats structure

From: Michael Holzheu <[email protected]>

The tgid is important for aggregating threads in user space. Therefore we
add the tgid to the taskstats structure.

Signed-off-by: Michael Holzheu <[email protected]>
---
include/linux/taskstats.h | 1 +
kernel/tsacct.c | 1 +
2 files changed, 2 insertions(+)

--- a/include/linux/taskstats.h
+++ b/include/linux/taskstats.h
@@ -167,6 +167,7 @@ struct taskstats {

/* Timestamp where data has been collected in ns since boot time */
__u64 time_ns;
+ __u32 ac_tgid; /* Thread group ID */
};


--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -56,6 +56,7 @@ void bacct_add_tsk(struct taskstats *sta
stats->ac_nice = task_nice(tsk);
stats->ac_sched = tsk->policy;
stats->ac_pid = tsk->pid;
+ stats->ac_tgid = tsk->tgid;
rcu_read_lock();
tcred = __task_cred(tsk);
stats->ac_uid = tcred->uid;