public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] per process I/O statistics for userspace
@ 2005-09-12 12:27 Levent Serinol
  2005-09-14  9:23 ` Pavel Machek
  0 siblings, 1 reply; 7+ messages in thread
From: Levent Serinol @ 2005-09-12 12:27 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Andrew Morton, jlan

with following patch, userspace processes/utilities will be able to
access per process I/O statistics. for example, top like utilites can
use this information.


--- linux-2.6.13/fs/proc/array.c.org    2005-08-29 02:41:01.000000000 +0300
+++ linux-2.6.13/fs/proc/array.c        2005-09-12 10:22:55.000000000 +0300
@@ -408,7 +408,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 %ld %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 %llu\n",
                task->pid,
                tcomm,
                state,
@@ -453,7 +453,9 @@ static int do_task_stat(struct task_stru
                task->exit_signal,
                task_cpu(task),
                task->rt_priority,
-               task->policy);
+               task->policy,
+               task->rchar,
+               task->wchar);
        if(mm)
                mmput(mm);
        return res;
--
Signed-off-by: Levent Serinol <lserinol@gmail.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] per process I/O statistics for userspace
  2005-09-12 12:27 [PATCH] per process I/O statistics for userspace Levent Serinol
@ 2005-09-14  9:23 ` Pavel Machek
  2005-09-14 20:17   ` Levent Serinol
  0 siblings, 1 reply; 7+ messages in thread
From: Pavel Machek @ 2005-09-14  9:23 UTC (permalink / raw)
  To: Levent Serinol; +Cc: Linux Kernel Mailing List, Andrew Morton, jlan

Hi!

> with following patch, userspace processes/utilities will be able to
> access per process I/O statistics. for example, top like utilites can
> use this information.

Nice, but should not this perhaps go into the other file? Adding more
integers into long line does not seem nice...
									Pavel

> 
> --- linux-2.6.13/fs/proc/array.c.org    2005-08-29 02:41:01.000000000 +0300
> +++ linux-2.6.13/fs/proc/array.c        2005-09-12 10:22:55.000000000 +0300
> @@ -408,7 +408,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 %ld %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 %llu\n",
>                 task->pid,
>                 tcomm,
>                 state,
> @@ -453,7 +453,9 @@ static int do_task_stat(struct task_stru
>                 task->exit_signal,
>                 task_cpu(task),
>                 task->rt_priority,
> -               task->policy);
> +               task->policy,
> +               task->rchar,
> +               task->wchar);
>         if(mm)
>                 mmput(mm);
>         return res;
> --
> Signed-off-by: Levent Serinol <lserinol@gmail.com>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
if you have sharp zaurus hardware you don't need... you know my address

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] per process I/O statistics for userspace
  2005-09-14  9:23 ` Pavel Machek
@ 2005-09-14 20:17   ` Levent Serinol
  2005-09-14 20:24     ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Levent Serinol @ 2005-09-14 20:17 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Linux Kernel Mailing List, Andrew Morton, jlan

Hi,

 You're right. Also, this information differs from other ones. So,
putting it into another file makes sense.
  Here is the better one which puts statistics in a file called iostat.

================================================================
--- linux-2.6.13/fs/proc/array.c.org    2005-08-29 02:41:01.000000000 +0300
+++ linux-2.6.13/fs/proc/array.c        2005-09-14 22:05:16.000000000 +0300
@@ -482,3 +482,8 @@ int proc_pid_statm(struct task_struct *t
        return sprintf(buffer,"%d %d %d %d %d %d %d\n",
                       size, resident, shared, text, lib, data, 0);
 }
+
+int proc_pid_iostat(struct task_struct *task, char *buffer)
+{
+       return sprintf(buffer,"%llu %llu\n",task->rchar,task->wchar);
+}
--- linux-2.6.13/fs/proc/base.c.org     2005-08-29 02:41:01.000000000 +0300
+++ linux-2.6.13/fs/proc/base.c 2005-09-14 22:04:03.000000000 +0300
@@ -86,6 +86,7 @@ enum pid_directory_inos {
        PROC_TGID_FD_DIR,
        PROC_TGID_OOM_SCORE,
        PROC_TGID_OOM_ADJUST,
+       PROC_TGID_IOSTAT,
        PROC_TID_INO,
        PROC_TID_STATUS,
        PROC_TID_MEM,
@@ -123,6 +124,7 @@ enum pid_directory_inos {
        PROC_TID_FD_DIR = 0x8000,       /* 0x8000-0xffff */
        PROC_TID_OOM_SCORE,
        PROC_TID_OOM_ADJUST,
+       PROC_TID_IOSTAT,
 };

  struct pid_entry {
@@ -169,6 +171,7 @@ static struct pid_entry tgid_base_stuff[
  #ifdef CONFIG_AUDITSYSCALL
        E(PROC_TGID_LOGINUID, "loginuid", S_IFREG|S_IWUSR|S_IRUGO),
  #endif
+       E(PROC_TGID_IOSTAT,    "iostat",   S_IFREG|S_IRUGO),
        {0,0,NULL,0}
 };
  static struct pid_entry tid_base_stuff[] = {
@@ -205,6 +208,7 @@ static struct pid_entry tid_base_stuff[]
  #ifdef CONFIG_AUDITSYSCALL
        E(PROC_TID_LOGINUID, "loginuid", S_IFREG|S_IWUSR|S_IRUGO),
  #endif
+       E(PROC_TID_IOSTAT,     "iostat",   S_IFREG|S_IRUGO),
        {0,0,NULL,0}
 };

@@ -1596,6 +1600,11 @@ static struct dentry *proc_pident_lookup
                        inode->i_fop = &proc_loginuid_operations;
                        break;
  #endif
+               case PROC_TID_IOSTAT:
+               case PROC_TGID_IOSTAT:
+                       inode->i_fop = &proc_info_file_operations;
+                       ei->op.proc_read = proc_pid_iostat;
+                       break;
                default:
                        printk("procfs: impossible type (%d)",p->type);
                        iput(inode);
--- linux-2.6.13/fs/proc/internal.h.org 2005-09-14 22:07:07.000000000 +0300
+++ linux-2.6.13/fs/proc/internal.h     2005-09-14 22:06:41.000000000 +0300
@@ -36,6 +36,7 @@ extern int proc_tid_stat(struct task_str
  extern int proc_tgid_stat(struct task_struct *, char *);
  extern int proc_pid_status(struct task_struct *, char *);
  extern int proc_pid_statm(struct task_struct *, char *);
+extern int proc_pid_iostat(struct task_struct *, char *);

  static inline struct task_struct *proc_task(struct inode *inode)
 {
=================================================================

On 9/14/05, Pavel Machek <pavel@ucw.cz> wrote:
> Hi!
> 
> > with following patch, userspace processes/utilities will be able to
> > access per process I/O statistics. for example, top like utilites can
> > use this information.
> 
> Nice, but should not this perhaps go into the other file? Adding more
> integers into long line does not seem nice...
>                                                                         Pavel
> 
> >
> > --- linux-2.6.13/fs/proc/array.c.org    2005-08-29 02:41:01.000000000 +0300
> > +++ linux-2.6.13/fs/proc/array.c        2005-09-12 10:22:55.000000000 +0300
> > @@ -408,7 +408,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 %ld %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 %llu\n",
> >                 task->pid,
> >                 tcomm,
> >                 state,
> > @@ -453,7 +453,9 @@ static int do_task_stat(struct task_stru
> >                 task->exit_signal,
> >                 task_cpu(task),
> >                 task->rt_priority,
> > -               task->policy);
> > +               task->policy,
> > +               task->rchar,
> > +               task->wchar);
> >         if(mm)
> >                 mmput(mm);
> >         return res;
> > --
> > Signed-off-by: Levent Serinol <lserinol@gmail.com>
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> 
> --
> if you have sharp zaurus hardware you don't need... you know my address
> 


-- 

Stay out of the road, if you want to grow old. 
~ Pink Floyd ~.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] per process I/O statistics for userspace
  2005-09-14 20:17   ` Levent Serinol
@ 2005-09-14 20:24     ` Andrew Morton
  2005-09-14 21:06       ` Jay Lan
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2005-09-14 20:24 UTC (permalink / raw)
  To: lserinol
  Cc: pavel, linux-kernel, jlan, lse-tech, Guillaume Thouvenin, kaigai,
	elsa-devel

Levent Serinol <lserinol@gmail.com> wrote:
>
> +int proc_pid_iostat(struct task_struct *task, char *buffer)
>  +{
>  +       return sprintf(buffer,"%llu %llu\n",task->rchar,task->wchar);
>  +}

Those fields have been sitting there unused for months.  I'd like to hear
what the system accounting guys are intending to do with them before
proceeding, please.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] per process I/O statistics for userspace
  2005-09-14 20:24     ` Andrew Morton
@ 2005-09-14 21:06       ` Jay Lan
  2005-09-17 17:36         ` Levent Serinol
  0 siblings, 1 reply; 7+ messages in thread
From: Jay Lan @ 2005-09-14 21:06 UTC (permalink / raw)
  To: Andrew Morton
  Cc: lserinol, pavel, linux-kernel, lse-tech, Guillaume Thouvenin,
	kaigai, elsa-devel, Erik Jacobson, John Hesterberg

Andrew,

These data are used in CSA Accounting today and i believe ELSA
intends to use them also.

Since PAGG is not in the tree, SGI have been offering our customers
PAGG/JOB/CSA kernel code as either kernel patches at oss.sgi.com
site or out-of-tree kernel modules today.

SGI intends to submit another solution for PAGG/JOB soon.

Once the future of PAGG/JOB becomes clear, we will know better how
to integrate CSA and BSD accounting. We are not sitting on it.

Thanks,
  - jay


Andrew Morton wrote:
> Levent Serinol <lserinol@gmail.com> wrote:
> 
>>+int proc_pid_iostat(struct task_struct *task, char *buffer)
>> +{
>> +       return sprintf(buffer,"%llu %llu\n",task->rchar,task->wchar);
>> +}
> 
> 
> Those fields have been sitting there unused for months.  I'd like to hear
> what the system accounting guys are intending to do with them before
> proceeding, please.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] per process I/O statistics for userspace
  2005-09-14 21:06       ` Jay Lan
@ 2005-09-17 17:36         ` Levent Serinol
  2005-09-17 20:58           ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Levent Serinol @ 2005-09-17 17:36 UTC (permalink / raw)
  To: Jay Lan
  Cc: Andrew Morton, pavel, linux-kernel, lse-tech, Guillaume Thouvenin,
	kaigai, elsa-devel, Erik Jacobson, John Hesterberg

Hi Andrew,

 What's your last decision about the patch ?

On 9/15/05, Jay Lan <jlan@engr.sgi.com> wrote:
> Andrew,
> 
> These data are used in CSA Accounting today and i believe ELSA
> intends to use them also.
> 
> Since PAGG is not in the tree, SGI have been offering our customers
> PAGG/JOB/CSA kernel code as either kernel patches at oss.sgi.com
> site or out-of-tree kernel modules today.
> 
> SGI intends to submit another solution for PAGG/JOB soon.
> 
> Once the future of PAGG/JOB becomes clear, we will know better how
> to integrate CSA and BSD accounting. We are not sitting on it.
> 
> Thanks,
>   - jay
> 
> 
> Andrew Morton wrote:
> > Levent Serinol <lserinol@gmail.com> wrote:
> >
> >>+int proc_pid_iostat(struct task_struct *task, char *buffer)
> >> +{
> >> +       return sprintf(buffer,"%llu %llu\n",task->rchar,task->wchar);
> >> +}
> >
> >
> > Those fields have been sitting there unused for months.  I'd like to hear
> > what the system accounting guys are intending to do with them before
> > proceeding, please.
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> 
> 


-- 

Stay out of the road, if you want to grow old. 
~ Pink Floyd ~.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] per process I/O statistics for userspace
  2005-09-17 17:36         ` Levent Serinol
@ 2005-09-17 20:58           ` Andrew Morton
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Morton @ 2005-09-17 20:58 UTC (permalink / raw)
  To: lserinol
  Cc: jlan, pavel, linux-kernel, lse-tech, guillaume.thouvenin, kaigai,
	elsa-devel, erikj, jh

Levent Serinol <lserinol@gmail.com> wrote:
>
> Hi Andrew,
> 

You inspired me.  Please see
http://www.zip.com.au/~akpm/linux/patches/stuff/top-posting.txt

>  What's your last decision about the patch ?

To wait and see what the system accounting guys come up with.  If we export
this info in /proc then it'll need to remain exported for ever.  So if/when
the system accounting people export it by other means, the info will be
duplicated.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-09-17 20:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-12 12:27 [PATCH] per process I/O statistics for userspace Levent Serinol
2005-09-14  9:23 ` Pavel Machek
2005-09-14 20:17   ` Levent Serinol
2005-09-14 20:24     ` Andrew Morton
2005-09-14 21:06       ` Jay Lan
2005-09-17 17:36         ` Levent Serinol
2005-09-17 20:58           ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox