From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrea Righi Subject: [PATCH 8/9] export per-task io-throttle statistics to userspace Date: Tue, 14 Apr 2009 22:21:19 +0200 Message-ID: <1239740480-28125-9-git-send-email-righi.andrea@gmail.com> References: <1239740480-28125-1-git-send-email-righi.andrea@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1239740480-28125-1-git-send-email-righi.andrea-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Paul Menage Cc: randy.dunlap-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org, Carl Henrik Lunde , eric.rannaud-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, Balbir Singh , fernando-gVGce1chcLdL9jVzuh4AOg@public.gmane.org, Andrea Righi , dradford-cT2on/YLNlBWk0Htik3J/w@public.gmane.org, agk-9JcytcrH/bA+uJoB2kUjGw@public.gmane.org, subrata-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org, axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org, matt-cT2on/YLNlBWk0Htik3J/w@public.gmane.org, roberto-5KDOxZqKugI@public.gmane.org, ngupta-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org List-Id: containers.vger.kernel.org Export the throttling statistics collected for each task through /proc/PID/io-throttle-stat. Example: $ cat /proc/$$/io-throttle-stat 0 0 0 0 ^ ^ ^ ^ \ \ \ \_____global iops sleep (in clock ticks) \ \ \______global iops counter \ \_______global bandwidth sleep (in clock ticks) \________global bandwidth counter Signed-off-by: Andrea Righi --- fs/proc/base.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index f715597..c07ee00 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -2453,6 +2454,17 @@ 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 %llu %llu\n", + get_io_throttle_cnt(task, IOTHROTTLE_BANDWIDTH), + get_io_throttle_sleep(task, IOTHROTTLE_BANDWIDTH), + get_io_throttle_cnt(task, IOTHROTTLE_IOPS), + get_io_throttle_sleep(task, IOTHROTTLE_IOPS)); +} +#endif /* CONFIG_CGROUP_IO_THROTTLE */ + static int proc_pid_personality(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task) { @@ -2539,6 +2551,9 @@ static const struct pid_entry tgid_base_stuff[] = { #ifdef CONFIG_TASK_IO_ACCOUNTING INF("io", S_IRUGO, proc_tgid_io_accounting), #endif +#ifdef CONFIG_CGROUP_IO_THROTTLE + INF("io-throttle-stat", S_IRUGO, proc_iothrottle_stat), +#endif }; static int proc_tgid_base_readdir(struct file * filp, @@ -2874,6 +2889,9 @@ static const struct pid_entry tid_base_stuff[] = { #ifdef CONFIG_TASK_IO_ACCOUNTING INF("io", S_IRUGO, proc_tid_io_accounting), #endif +#ifdef CONFIG_CGROUP_IO_THROTTLE + INF("io-throttle-stat", S_IRUGO, proc_iothrottle_stat), +#endif }; static int proc_tid_base_readdir(struct file * filp, -- 1.5.6.3 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755683AbZDNUYY (ORCPT ); Tue, 14 Apr 2009 16:24:24 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754814AbZDNUVx (ORCPT ); Tue, 14 Apr 2009 16:21:53 -0400 Received: from mail-fx0-f158.google.com ([209.85.220.158]:48643 "EHLO mail-fx0-f158.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754594AbZDNUVv (ORCPT ); Tue, 14 Apr 2009 16:21:51 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=LlQaR3elX0hhAXxnyWYokWr09n8NsfH16jFsIzABeKNyvHlUJ8jv1b8EbdXVmSlWrQ GmXOSE63iaBbJv1gDYMkfdb+5Ch1u6R6ryNArZ0VK+81918dtJPiHQKAvEsTRwqz4pPw DU2zbdF68SskLeiTAKwyBn2jkddB5fbbRc4OU= From: Andrea Righi To: Paul Menage Cc: Balbir Singh , Gui Jianfeng , KAMEZAWA Hiroyuki , agk@sourceware.org, akpm@linux-foundation.org, axboe@kernel.dk, baramsori72@gmail.com, Carl Henrik Lunde , dave@linux.vnet.ibm.com, Divyesh Shah , eric.rannaud@gmail.com, fernando@oss.ntt.co.jp, Hirokazu Takahashi , Li Zefan , matt@bluehost.com, dradford@bluehost.com, ngupta@google.com, randy.dunlap@oracle.com, roberto@unbit.it, Ryo Tsuruta , Satoshi UCHIDA , subrata@linux.vnet.ibm.com, yoshikawa.takuya@oss.ntt.co.jp, containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Andrea Righi Subject: [PATCH 8/9] export per-task io-throttle statistics to userspace Date: Tue, 14 Apr 2009 22:21:19 +0200 Message-Id: <1239740480-28125-9-git-send-email-righi.andrea@gmail.com> X-Mailer: git-send-email 1.5.6.3 In-Reply-To: <1239740480-28125-1-git-send-email-righi.andrea@gmail.com> References: <1239740480-28125-1-git-send-email-righi.andrea@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Export the throttling statistics collected for each task through /proc/PID/io-throttle-stat. Example: $ cat /proc/$$/io-throttle-stat 0 0 0 0 ^ ^ ^ ^ \ \ \ \_____global iops sleep (in clock ticks) \ \ \______global iops counter \ \_______global bandwidth sleep (in clock ticks) \________global bandwidth counter Signed-off-by: Andrea Righi --- fs/proc/base.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index f715597..c07ee00 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -2453,6 +2454,17 @@ 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 %llu %llu\n", + get_io_throttle_cnt(task, IOTHROTTLE_BANDWIDTH), + get_io_throttle_sleep(task, IOTHROTTLE_BANDWIDTH), + get_io_throttle_cnt(task, IOTHROTTLE_IOPS), + get_io_throttle_sleep(task, IOTHROTTLE_IOPS)); +} +#endif /* CONFIG_CGROUP_IO_THROTTLE */ + static int proc_pid_personality(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task) { @@ -2539,6 +2551,9 @@ static const struct pid_entry tgid_base_stuff[] = { #ifdef CONFIG_TASK_IO_ACCOUNTING INF("io", S_IRUGO, proc_tgid_io_accounting), #endif +#ifdef CONFIG_CGROUP_IO_THROTTLE + INF("io-throttle-stat", S_IRUGO, proc_iothrottle_stat), +#endif }; static int proc_tgid_base_readdir(struct file * filp, @@ -2874,6 +2889,9 @@ static const struct pid_entry tid_base_stuff[] = { #ifdef CONFIG_TASK_IO_ACCOUNTING INF("io", S_IRUGO, proc_tid_io_accounting), #endif +#ifdef CONFIG_CGROUP_IO_THROTTLE + INF("io-throttle-stat", S_IRUGO, proc_iothrottle_stat), +#endif }; static int proc_tid_base_readdir(struct file * filp, -- 1.5.6.3