mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shailabh Nagar <nagar@watson.ibm.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: LSE <lse-tech@lists.sourceforge.net>, Jay Lan <jlan@engr.sgi.com>
Subject: [Patch 8/8] /proc export of aggregated block I/O delays
Date: Fri, 21 Apr 2006 22:42:17 -0400	[thread overview]
Message-ID: <44499809.1000301@watson.ibm.com> (raw)
In-Reply-To: <444991EF.3080708@watson.ibm.com>

Changelog
Fixed comments by akpm
- use __u64 for delayacct_blkio_ticks() return type
- redundant check for tsk->delays in __delayacct_blkio_ticks()


delayacct-procfs.patch

Export I/O delays seen by a task through /proc/<tgid>/stats
for use in top etc.

Note that delays for I/O done for swapping in pages (swapin I/O) is
clubbed together with all other I/O here (this is not the
case in the netlink interface where the swapin I/O is kept distinct)

Signed-off-by: Shailabh Nagar <nagar@watson.ibm.com>
 fs/proc/array.c           |    6 ++++--
 include/linux/delayacct.h |   10 ++++++++++
 kernel/delayacct.c        |   12 ++++++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)

Index: linux-2.6.17-rc1/fs/proc/array.c
===================================================================
--- linux-2.6.17-rc1.orig/fs/proc/array.c	2006-04-21 19:39:28.000000000 -0400
+++ linux-2.6.17-rc1/fs/proc/array.c	2006-04-21 20:55:09.000000000 -0400
@@ -75,6 +75,7 @@
 #include <linux/times.h>
 #include <linux/cpuset.h>
 #include <linux/rcupdate.h>
+#include <linux/delayacct.h>

 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -412,7 +413,7 @@ static int do_task_stat(struct task_stru

 	res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
 %lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \
-%lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu\n",
+%lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu %llu\n",
 		task->pid,
 		tcomm,
 		state,
@@ -456,7 +457,8 @@ static int do_task_stat(struct task_stru
 		task->exit_signal,
 		task_cpu(task),
 		task->rt_priority,
-		task->policy);
+		task->policy,
+		delayacct_blkio_ticks(task));
 	if(mm)
 		mmput(mm);
 	return res;
Index: linux-2.6.17-rc1/include/linux/delayacct.h
===================================================================
--- linux-2.6.17-rc1.orig/include/linux/delayacct.h	2006-04-21 20:42:41.000000000 -0400
+++ linux-2.6.17-rc1/include/linux/delayacct.h	2006-04-21 20:55:58.000000000 -0400
@@ -37,6 +37,7 @@ extern void __delayacct_tsk_exit(struct
 extern void __delayacct_blkio_start(void);
 extern void __delayacct_blkio_end(void);
 extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *);
+extern __u64 __delayacct_blkio_ticks(struct task_struct *);

 static inline void delayacct_set_flag(int flag)
 {
@@ -83,6 +84,13 @@ static inline int delayacct_add_tsk(stru
 	return __delayacct_add_tsk(d, tsk);
 }

+static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk)
+{
+	if (tsk->delays)
+		return __delayacct_blkio_ticks(tsk);
+	return 0;
+}
+
 #else
 static inline void delayacct_set_flag(int flag)
 {}
@@ -100,6 +108,8 @@ static inline void delayacct_blkio_end(v
 {}
 static inline int delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk)
 { return 0; }
+static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk)
+{ return 0; }
 #endif /* CONFIG_TASK_DELAY_ACCT */

 #endif
Index: linux-2.6.17-rc1/kernel/delayacct.c
===================================================================
--- linux-2.6.17-rc1.orig/kernel/delayacct.c	2006-04-21 20:40:03.000000000 -0400
+++ linux-2.6.17-rc1/kernel/delayacct.c	2006-04-21 20:55:09.000000000 -0400
@@ -146,3 +146,15 @@ int __delayacct_add_tsk(struct taskstats

 	return 0;
 }
+
+__u64 __delayacct_blkio_ticks(struct task_struct *tsk)
+{
+	__u64 ret;
+
+	spin_lock(&tsk->delays->lock);
+	ret = nsec_to_clock_t(tsk->delays->blkio_delay +
+				tsk->delays->swapin_delay);
+	spin_unlock(&tsk->delays->lock);
+	return ret;
+}
+

  parent reply	other threads:[~2006-04-22 21:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-22  2:16 [Patch 0/8] per-task delay accounting Shailabh Nagar
2006-04-22  2:23 ` [Patch 1/8] Setup Shailabh Nagar
2006-04-24  2:02   ` Randy.Dunlap
2006-04-24 17:26     ` Shailabh Nagar
2006-04-22  2:29 ` [Patch 2/8] Sync block I/O and swapin delay collection Shailabh Nagar
2006-04-22  2:33 ` [Patch 3/8] cpu delay collection via schedstats Shailabh Nagar
2006-04-22  2:35 ` [Patch 4/8] Utilities for genetlink usage Shailabh Nagar
2006-04-22  2:37 ` [Patch 5/8] taskstats interface Shailabh Nagar
2006-04-27  1:12   ` Jay Lan
2006-04-27  4:00     ` Shailabh Nagar
2006-04-27  6:42       ` [Lse-tech] " Balbir Singh
2006-04-27 17:52         ` Jay Lan
2006-04-27 18:27           ` Balbir Singh
2006-04-27 19:34             ` Jay Lan
2006-04-28  2:59               ` Balbir Singh
2006-04-28 18:20                 ` Jay Lan
2006-04-28 18:35                   ` Balbir Singh
2006-04-22  2:39 ` [Patch 6/8] delay accounting usage of " Shailabh Nagar
2006-04-22  2:40 ` [Patch 7/8] documentation Shailabh Nagar
2006-04-22  2:42 ` Shailabh Nagar [this message]
2006-04-22  7:46   ` [Lse-tech] [Patch 8/8] /proc export of aggregated block I/O delays Andi Kleen
2006-04-25 15:07 ` [Patch 0/8] per-task delay accounting Shailabh Nagar
2006-05-02  6:21 [Patch 8/8] /proc export of aggregated block I/O delays Balbir Singh

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=44499809.1000301@watson.ibm.com \
    --to=nagar@watson.ibm.com \
    --cc=jlan@engr.sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lse-tech@lists.sourceforge.net \
    /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

Powered by JetHome