aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/taskstats.c4
-rw-r--r--kernel/tsacct.c19
2 files changed, 23 insertions, 0 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 6c38dce88e8c..5d6a8c54ee85 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -20,6 +20,7 @@
20#include <linux/taskstats_kern.h> 20#include <linux/taskstats_kern.h>
21#include <linux/tsacct_kern.h> 21#include <linux/tsacct_kern.h>
22#include <linux/delayacct.h> 22#include <linux/delayacct.h>
23#include <linux/tsacct_kern.h>
23#include <linux/cpumask.h> 24#include <linux/cpumask.h>
24#include <linux/percpu.h> 25#include <linux/percpu.h>
25#include <net/genetlink.h> 26#include <net/genetlink.h>
@@ -204,6 +205,9 @@ static int fill_pid(pid_t pid, struct task_struct *pidtsk,
204 stats->version = TASKSTATS_VERSION; 205 stats->version = TASKSTATS_VERSION;
205 bacct_add_tsk(stats, tsk); 206 bacct_add_tsk(stats, tsk);
206 207
208 /* fill in extended acct fields */
209 xacct_add_tsk(stats, tsk);
210
207 /* Define err: label here if needed */ 211 /* Define err: label here if needed */
208 put_task_struct(tsk); 212 put_task_struct(tsk);
209 return rc; 213 return rc;
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index 899067950a88..410483490cf6 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -70,3 +70,22 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
70 strncpy(stats->ac_comm, tsk->comm, sizeof(stats->ac_comm)); 70 strncpy(stats->ac_comm, tsk->comm, sizeof(stats->ac_comm));
71} 71}
72 72
73
74#ifdef CONFIG_TASK_XACCT
75/*
76 * fill in extended accounting fields
77 */
78void xacct_add_tsk(struct taskstats *stats, struct task_struct *p)
79{
80 stats->acct_rss_mem1 = p->acct_rss_mem1;
81 stats->acct_vm_mem1 = p->acct_vm_mem1;
82 if (p->mm) {
83 stats->hiwater_rss = p->mm->hiwater_rss;
84 stats->hiwater_vm = p->mm->hiwater_vm;
85 }
86 stats->read_char = p->rchar;
87 stats->write_char = p->wchar;
88 stats->read_syscalls = p->syscr;
89 stats->write_syscalls = p->syscw;
90}
91#endif