Split the extended accounting taskstats fields into the threadgroup specific
ones and the thread specific ones. This should have no effect on the execution.

Signed-off-by: Guillaume Chazarain <[EMAIL PROTECTED]>
Cc: Balbir Singh <[EMAIL PROTECTED]>
Cc: Jay Lan <[EMAIL PROTECTED]>
Cc: Jonathan Lim <[EMAIL PROTECTED]>
Cc: Oleg Nesterov <[EMAIL PROTECTED]>
---

 kernel/tsacct.c |   48 ++++++++++++++++++++++++++++--------------------
 1 files changed, 28 insertions(+), 20 deletions(-)


diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index d32378f..e8c25d2 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -101,33 +101,41 @@ static void bacct_fill_threadgroup(struct taskstats 
*stats,
 /*
  * fill in extended accounting fields
  */
-void xacct_add_tsk(struct taskstats *stats, struct task_struct *p)
+
+static void xacct_fill_threadgroup(struct taskstats *stats,
+                                  struct task_struct *tsk);
+
+void xacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
+{
+       /* convert pages-jiffies to Mbyte-usec */
+       stats->coremem += jiffies_to_usecs(tsk->acct_rss_mem1) * PAGE_SIZE / MB;
+       stats->virtmem += jiffies_to_usecs(tsk->acct_vm_mem1)  * PAGE_SIZE / MB;
+
+       stats->read_char        += tsk->rchar;
+       stats->write_char       += tsk->wchar;
+       stats->read_syscalls    += tsk->syscr;
+       stats->write_syscalls   += tsk->syscw;
+#ifdef CONFIG_TASK_IO_ACCOUNTING
+       stats->read_bytes       += tsk->ioac.read_bytes;
+       stats->write_bytes      += tsk->ioac.write_bytes;
+       stats->cancelled_write_bytes += tsk->ioac.cancelled_write_bytes;
+#endif
+
+       xacct_fill_threadgroup(stats, tsk);
+}
+
+static void xacct_fill_threadgroup(struct taskstats *stats,
+                                  struct task_struct *tsk)
 {
        struct mm_struct *mm;
 
-       /* convert pages-jiffies to Mbyte-usec */
-       stats->coremem = jiffies_to_usecs(p->acct_rss_mem1) * PAGE_SIZE / MB;
-       stats->virtmem = jiffies_to_usecs(p->acct_vm_mem1) * PAGE_SIZE / MB;
-       mm = get_task_mm(p);
+       mm = get_task_mm(tsk);
        if (mm) {
                /* adjust to KB unit */
-               stats->hiwater_rss   = mm->hiwater_rss * PAGE_SIZE / KB;
-               stats->hiwater_vm    = mm->hiwater_vm * PAGE_SIZE / KB;
+               stats->hiwater_rss = mm->hiwater_rss * PAGE_SIZE / KB;
+               stats->hiwater_vm  = mm->hiwater_vm  * PAGE_SIZE / KB;
                mmput(mm);
        }
-       stats->read_char        = p->rchar;
-       stats->write_char       = p->wchar;
-       stats->read_syscalls    = p->syscr;
-       stats->write_syscalls   = p->syscw;
-#ifdef CONFIG_TASK_IO_ACCOUNTING
-       stats->read_bytes       = p->ioac.read_bytes;
-       stats->write_bytes      = p->ioac.write_bytes;
-       stats->cancelled_write_bytes = p->ioac.cancelled_write_bytes;
-#else
-       stats->read_bytes       = 0;
-       stats->write_bytes      = 0;
-       stats->cancelled_write_bytes = 0;
-#endif
 }
 #undef KB
 #undef MB
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to