Skip to contentSkip to conversation

export per-task i/o throttling statistics to userspace

PATCH In review Andrea Righi 1 participant 1 message Sep 17, 2008 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 6/6 export per-task i/o throttling statistics to userspace

Export the throttling statistics collected for each task through /proc/PID/io-throttle-stat:
- total number of delayed I/O request
- total amount of time in clock ticks spent to wait for the delayed requests

---
 fs/proc/base.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
fs/proc/base.c +15 -0
index 63617ca..e53b06c 100644
@@ -54,6 +54,7 @@
 #include <linux/proc_fs.h>
 #include <linux/stat.h>
 #include <linux/task_io_accounting_ops.h>
+#include <linux/blk-io-throttle.h>
 #include <linux/init.h>
 #include <linux/capability.h>
 #include <linux/file.h>
@@ -2459,6 +2460,14 @@ static int proc_tgid_io_accounting(struct task_struct *task, char *buffer)
 }
 #endif /* CONFIG_TASK_IO_ACCOUNTING */
 
+#ifdef CONFIG_CGROUP_IO_THROTTLE
+static int proc_iothrottle_stat(struct task_struct *task, char *buffer)
+{
+	return sprintf(buffer, "%llu %llu\n",
+		get_io_throttle_cnt(task), get_io_throttle_sleep(task));
+}
+#endif /* CONFIG_CGROUP_IO_THROTTLE */
+
 /*
  * Thread groups
  */
@@ -2534,6 +2543,9 @@ static const struct pid_entry tgid_base_stuff[] = {
 #ifdef CONFIG_TASK_IO_ACCOUNTING
 	INF("io",	S_IRUGO, tgid_io_accounting),
 #endif
+#ifdef CONFIG_CGROUP_IO_THROTTLE
+	INF("io-throttle-stat",	S_IRUGO, iothrottle_stat),
+#endif
 };
 
 static int proc_tgid_base_readdir(struct file * filp,
@@ -2865,6 +2877,9 @@ static const struct pid_entry tid_base_stuff[] = {
 #ifdef CONFIG_TASK_IO_ACCOUNTING
 	INF("io",	S_IRUGO, tid_io_accounting),
 #endif
+#ifdef CONFIG_CGROUP_IO_THROTTLE
+	INF("io-throttle-stat",	S_IRUGO, iothrottle_stat),
+#endif
 };
 
 static int proc_tid_base_readdir(struct file * filp,
Signature · 1 line
1.5.4.3