2002-03-06 17:44:13

by Jean-Eric Cuendet

[permalink] [raw]
Subject: [PATCH] Rework of /proc/stat

--- /tmp/linux-2.4.18-vanilla/include/linux/kernel_stat.h Thu Nov 22 20:46:19 2001
+++ /toc/linux-2.4.18-reempt/include/linux/kernel_stat.h Wed Mar 6 18:02:57 2002
@@ -12,18 +12,37 @@
* used by rstatd/perfmeter
*/

-#define DK_MAX_MAJOR 16
-#define DK_MAX_DISK 16
+#define DK_MAX_DEVICES 64
+#define DK_BUCKETS 256
+
+
+struct _kstat_block_io
+{
+ struct _kstat_block_io* next;
+
+ unsigned int major;
+ unsigned int minor;
+
+ unsigned int io;
+ unsigned int rio;
+ unsigned int wio;
+ unsigned int rblk;
+ unsigned int wblk;
+};
+typedef struct _kstat_block_io kstat_block_io;
+
+
+/* static array of IO stats */
+extern unsigned int kstat_devices_current_index;
+extern kstat_block_io kstat_devices_array[DK_MAX_DEVICES];
+
+

struct kernel_stat {
unsigned int per_cpu_user[NR_CPUS],
per_cpu_nice[NR_CPUS],
per_cpu_system[NR_CPUS];
- unsigned int dk_drive[DK_MAX_MAJOR][DK_MAX_DISK];
- unsigned int dk_drive_rio[DK_MAX_MAJOR][DK_MAX_DISK];
- unsigned int dk_drive_wio[DK_MAX_MAJOR][DK_MAX_DISK];
- unsigned int dk_drive_rblk[DK_MAX_MAJOR][DK_MAX_DISK];
- unsigned int dk_drive_wblk[DK_MAX_MAJOR][DK_MAX_DISK];
+ kstat_block_io* io_stat_tbl[DK_BUCKETS];
unsigned int pgpgin, pgpgout;
unsigned int pswpin, pswpout;
#if !defined(CONFIG_ARCH_S390)
@@ -37,6 +56,103 @@

extern struct kernel_stat kstat;

+
+
+/* Size of the table */
+extern const unsigned int kstat_block_io_tbl_size;
+
+/* hash function */
+static inline unsigned kstat_block_io_hash(unsigned int major, unsigned int minor)
+{
+ return major * 1999 ^ minor;
+}
+
+
+/* add an IO stat */
+static inline kstat_block_io* kstat_block_io_add(unsigned int major, unsigned int minor)
+{
+ unsigned int i;
+ kstat_block_io* p;
+ kstat_block_io* pstat;
+
+ if (kstat_devices_current_index >= DK_MAX_DEVICES)
+ {
+ printk("ERROR: kstat: No more slot for device IO stats. Try extending DK_MAX_DEVICES\n");
+ return 0;
+ }
+
+ pstat = &kstat_devices_array[kstat_devices_current_index];
+ kstat_devices_current_index++;
+ pstat->next = 0;
+ pstat->major = major;
+ pstat->minor = minor;
+ pstat->io = 0;
+ pstat->rio = 0;
+ pstat->wio = 0;
+ pstat->rblk = 0;
+ pstat->wblk = 0;
+
+ i = kstat_block_io_hash(major, minor) % kstat_block_io_tbl_size;
+ p = kstat.io_stat_tbl[i];
+ if (p == 0)
+ {
+ kstat.io_stat_tbl[i] = pstat;
+ }
+ else
+ {
+ printk("WARNING: kstat: Collision found in IO stat accounting table (add). Try extending DK_BUCKETS\n");
+ while (p->next != 0)
+ {
+ p = p->next;
+ }
+ p->next = pstat;
+ }
+ return pstat;
+}
+
+/* lookup an IO stat */
+static inline kstat_block_io* kstat_block_io_lookup(unsigned major, unsigned minor)
+{
+ unsigned int i = kstat_block_io_hash(major, minor) % kstat_block_io_tbl_size;
+ kstat_block_io* p = kstat.io_stat_tbl[i];
+ while (p && p->major != major && p->minor != minor)
+ {
+ printk("WARNING: kstat: Collision found in IO stat accounting table (lookup). Try extending DK_BUCKETS\n");
+ p = p->next;
+ }
+ if (p == 0)
+ {
+ p = kstat_block_io_add(major, minor);
+ if (p == 0)
+ {
+ return 0;
+ }
+ }
+ return p;
+}
+
+/* This is used by MD to see if IDLE */
+static inline unsigned long kstat_get_rwblk(unsigned int major, unsigned int minor)
+{
+ kstat_block_io* stat = kstat_block_io_lookup(major, minor);
+ if (stat == 0)
+ {
+ printk("ERROR: kstat: No IO stat found for (%d/%d)\n", major, minor);
+ return 0;
+ }
+ return stat->rblk + stat->wblk;
+}
+
+
+
+
+
+
+
+
+
+
+
#if !defined(CONFIG_ARCH_S390)
/*
* Number of interrupts per specific IRQ source, since bootup
--- /tmp/linux-2.4.18-vanilla/drivers/md/md.c Mon Feb 25 20:37:58 2002
+++ /toc/linux-2.4.18-reempt/drivers/md/md.c Wed Mar 6 16:46:56 2002
@@ -3284,6 +3284,9 @@
return NULL;
}

+/* MD devices are major=9 and minor=1-31 */
+#define DK_MAX_MAJOR 16
+#define DK_MAX_DISK 32
static unsigned int sync_io[DK_MAX_MAJOR][DK_MAX_DISK];
void md_sync_acct(kdev_t dev, unsigned long nr_sectors)
{
@@ -3305,15 +3308,12 @@
unsigned long curr_events;

idle = 1;
- ITERATE_RDEV(mddev,rdev,tmp) {
+ ITERATE_RDEV(mddev,rdev,tmp)
+ {
int major = MAJOR(rdev->dev);
int idx = disk_index(rdev->dev);

- if ((idx >= DK_MAX_DISK) || (major >= DK_MAX_MAJOR))
- continue;
-
- curr_events = kstat.dk_drive_rblk[major][idx] +
- kstat.dk_drive_wblk[major][idx] ;
+ curr_events = kstat_get_rwblk(major, idx);
curr_events -= sync_io[major][idx];
if ((curr_events - rdev->last_events) > 32) {
rdev->last_events = curr_events;
--- /tmp/linux-2.4.18-vanilla/drivers/block/ll_rw_blk.c Mon Feb 25 20:37:57 2002
+++ /toc/linux-2.4.18-reempt/drivers/block/ll_rw_blk.c Wed Mar 6 18:12:03 2002
@@ -501,19 +501,22 @@
unsigned long nr_sectors, int new_io)
{
unsigned int major = MAJOR(dev);
- unsigned int index;
+ unsigned int minor = MINOR(dev);
+ kstat_block_io* stat = kstat_block_io_lookup(major, minor);

- index = disk_index(dev);
- if ((index >= DK_MAX_DISK) || (major >= DK_MAX_MAJOR))
- return;
+ if (stat == 0)
+ {
+ printk("ERROR: kstat: Haven't found an IO stat struct for major=%d / minor=%d\n", major, minor);
+ return;
+ }

- kstat.dk_drive[major][index] += new_io;
+ stat->io += new_io;
if (rw == READ) {
- kstat.dk_drive_rio[major][index] += new_io;
- kstat.dk_drive_rblk[major][index] += nr_sectors;
+ stat->rio += new_io;
+ stat->rblk += nr_sectors;
} else if (rw == WRITE) {
- kstat.dk_drive_wio[major][index] += new_io;
- kstat.dk_drive_wblk[major][index] += nr_sectors;
+ stat->wio += new_io;
+ stat->wblk += nr_sectors;
} else
printk(KERN_ERR "drive_stat_acct: cmd not R/W?\n");
}
--- /tmp/linux-2.4.18-vanilla/fs/proc/proc_misc.c Wed Nov 21 06:29:09 2001
+++ /toc/linux-2.4.18-reempt/fs/proc/proc_misc.c Wed Mar 6 17:41:28 2002
@@ -282,25 +282,19 @@
len += sprintf(page + len, " %u", kstat_irqs(i));
#endif

- len += sprintf(page + len, "\ndisk_io: ");
+ len += sprintf(page + len, "\ndisk_io: ");

- for (major = 0; major < DK_MAX_MAJOR; major++) {
- for (disk = 0; disk < DK_MAX_DISK; disk++) {
- int active = kstat.dk_drive[major][disk] +
- kstat.dk_drive_rblk[major][disk] +
- kstat.dk_drive_wblk[major][disk];
- if (active)
- len += sprintf(page + len,
- "(%u,%u):(%u,%u,%u,%u,%u) ",
- major, disk,
- kstat.dk_drive[major][disk],
- kstat.dk_drive_rio[major][disk],
- kstat.dk_drive_rblk[major][disk],
- kstat.dk_drive_wio[major][disk],
- kstat.dk_drive_wblk[major][disk]
- );
- }
- }
+ for (i = 0; i < kstat_devices_current_index; i++)
+ {
+ kstat_block_io* stat = &kstat_devices_array[i];
+ len += sprintf( page + len, "(%u,%u):(%u,%u,%u,%u,%u) ",
+ stat->major, stat->minor,
+ stat->io,
+ stat->rio,
+ stat->wio,
+ stat->rblk,
+ stat->wblk );
+ }

len += sprintf(page + len,
"\nctxt %u\n"


Attachments:
proc_stat.patch (6.91 kB)

2002-03-06 20:14:51

by James Stevenson

[permalink] [raw]
Subject: Re: [PATCH] Rework of /proc/stat

Hi

would a patch like this not make more sense
i picked it up on this list a while ago i cannot remember who wrote it
fixed it a bit and it does much the same except it alows you to have
any number of block devices though it does not work with scsi properly yet.

diff against 2.4.18

>
> Hi,
> I've made a new version of IO statistics in kstat that remove the
> previous limitations of MAX_MAJOR. I've made tests on my machine only, so
could someone test it, please?
> Feedback welcome.
> Bye
> -jec
>
> Patch attached.
>
Index: v2.4/drivers/block/ll_rw_blk.c
diff -u v2.4/drivers/block/ll_rw_blk.c:1.1.1.2
v2.4/drivers/block/ll_rw_blk.c:1.1.1.2.2.1
--- v2.4/drivers/block/ll_rw_blk.c:1.1.1.2 Mon Feb 25 21:54:45 2002
+++ v2.4/drivers/block/ll_rw_blk.c Mon Feb 25 22:53:10 2002
@@ -183,7 +183,11 @@

if (count)
printk("blk_cleanup_queue: leaked requests (%d)\n", count);
-
+ /*
+ * free statistics structure
+ */
+ kfree(q->dk_stat);
+
memset(q, 0, sizeof(*q));
}

@@ -393,6 +397,8 @@
**/
void blk_init_queue(request_queue_t * q, request_fn_proc * rfn)
{
+ struct disk_stat * new;
+
INIT_LIST_HEAD(&q->queue_head);
elevator_init(&q->elevator, ELEVATOR_LINUS);
blk_init_free_list(q);
@@ -413,6 +419,15 @@
*/
q->plug_device_fn = generic_plug_device;
q->head_active = 1;
+ /*
+ * At last, allocate and initialize the statistics
+ */
+ new = kmalloc(sizeof(struct disk_stat), GFP_KERNEL);
+ if (new == NULL)
+ printk(KERN_ERR "blk_init_queue:error allocating statisitcs\n");
+ else
+ memset(new, 0, sizeof(struct disk_stat));
+ q->dk_stat = new;
}

#define blkdev_free_rq(list) list_entry((list)->next, struct request,
queue);
@@ -497,23 +512,18 @@
else ro_bits[major][minor >> 5] &= ~(1 << (minor & 31));
}

-inline void drive_stat_acct (kdev_t dev, int rw,
+inline void drive_stat_acct (struct disk_stat * ds, int rw,
unsigned long nr_sectors, int new_io)
{
- unsigned int major = MAJOR(dev);
- unsigned int index;
-
- index = disk_index(dev);
- if ((index >= DK_MAX_DISK) || (major >= DK_MAX_MAJOR))
+ if (ds == NULL)
return;

- kstat.dk_drive[major][index] += new_io;
if (rw == READ) {
- kstat.dk_drive_rio[major][index] += new_io;
- kstat.dk_drive_rblk[major][index] += nr_sectors;
+ ds->dk_drive_rio += new_io;
+ ds->dk_drive_rblk += nr_sectors;
} else if (rw == WRITE) {
- kstat.dk_drive_wio[major][index] += new_io;
- kstat.dk_drive_wblk[major][index] += nr_sectors;
+ ds->dk_drive_wio += new_io;
+ ds->dk_drive_wblk += nr_sectors;
} else
printk(KERN_ERR "drive_stat_acct: cmd not R/W?\n");
}
@@ -529,7 +539,7 @@
static inline void add_request(request_queue_t * q, struct request * req,
struct list_head *insert_here)
{
- drive_stat_acct(req->rq_dev, req->cmd, req->nr_sectors, 1);
+ drive_stat_acct(q->dk_stat, req->cmd, req->nr_sectors, 1);

if (!q->plugged && q->head_active && insert_here == &q->queue_head) {
spin_unlock_irq(&io_request_lock);
@@ -703,7 +713,7 @@
req->bhtail = bh;
req->nr_sectors = req->hard_nr_sectors += count;
blk_started_io(count);
- drive_stat_acct(req->rq_dev, req->cmd, count, 0);
+ drive_stat_acct(q->dk_stat, req->cmd, count, 0);
attempt_back_merge(q, req, max_sectors, max_segments);
goto out;

@@ -720,7 +730,7 @@
req->sector = req->hard_sector = sector;
req->nr_sectors = req->hard_nr_sectors += count;
blk_started_io(count);
- drive_stat_acct(req->rq_dev, req->cmd, count, 0);
+ drive_stat_acct(q->dk_stat, req->cmd, count, 0);
attempt_front_merge(q, head, req, max_sectors, max_segments);
goto out;

Index: v2.4/drivers/ide/ide.c
diff -u v2.4/drivers/ide/ide.c:1.1.1.2 v2.4/drivers/ide/ide.c:1.1.1.2.2.1
--- v2.4/drivers/ide/ide.c:1.1.1.2 Mon Feb 25 21:55:52 2002
+++ v2.4/drivers/ide/ide.c Mon Feb 25 22:53:10 2002
@@ -1454,8 +1454,10 @@
request_queue_t *ide_get_queue (kdev_t dev)
{
ide_hwif_t *hwif = (ide_hwif_t *)blk_dev[MAJOR(dev)].data;
-
- return &hwif->drives[DEVICE_NR(dev) & 1].queue;
+ if (DEVICE_NR(dev) >= MAX_DRIVES)
+ return NULL;
+ else
+ return &hwif->drives[DEVICE_NR(dev)].queue;
}

/*
Index: v2.4/drivers/md/md.c
diff -u v2.4/drivers/md/md.c:1.1.1.2 v2.4/drivers/md/md.c:1.1.1.2.2.1
--- v2.4/drivers/md/md.c:1.1.1.2 Mon Feb 25 21:55:55 2002
+++ v2.4/drivers/md/md.c Mon Feb 25 22:53:10 2002
@@ -3308,12 +3308,15 @@
ITERATE_RDEV(mddev,rdev,tmp) {
int major = MAJOR(rdev->dev);
int idx = disk_index(rdev->dev);
-
+ request_queue_t * rq = blk_get_queue(rdev->dev);
+
if ((idx >= DK_MAX_DISK) || (major >= DK_MAX_MAJOR))
continue;
-
- curr_events = kstat.dk_drive_rblk[major][idx] +
- kstat.dk_drive_wblk[major][idx] ;
+
+ if (rq == NULL || (rq->dk_stat == NULL))
+ continue;
+ curr_events = rq->dk_stat->dk_drive_rblk +
+ rq->dk_stat->dk_drive_wblk ;
curr_events -= sync_io[major][idx];
if ((curr_events - rdev->last_events) > 32) {
rdev->last_events = curr_events;
Index: v2.4/fs/proc/proc_misc.c
diff -u v2.4/fs/proc/proc_misc.c:1.1.1.1
v2.4/fs/proc/proc_misc.c:1.1.1.1.4.1
--- v2.4/fs/proc/proc_misc.c:1.1.1.1 Sun Jan 13 15:50:20 2002
+++ v2.4/fs/proc/proc_misc.c Mon Feb 25 22:53:10 2002
@@ -36,12 +36,12 @@
#include <linux/init.h>
#include <linux/smp_lock.h>
#include <linux/seq_file.h>
+#include <linux/blkdev.h>

#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/io.h>

-
#define LOAD_INT(x) ((x) >> FSHIFT)
#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
/*
@@ -234,7 +234,23 @@
release: seq_release,
};
#endif
-
+static int show_disk_stat(char * page, int len, struct disk_stat * ds,
+ int major, int disk)
+{
+ int active = ds->dk_drive_rio + ds->dk_drive_wio +
+ ds->dk_drive_rblk + ds->dk_drive_wblk;
+ if (active)
+ len += sprintf(page + len,
+ "(%u,%u):(%u,%u,%u,%u,%u) ",
+ major, disk,
+ ds->dk_drive_rio + ds->dk_drive_wio,
+ ds->dk_drive_rio,
+ ds->dk_drive_rblk,
+ ds->dk_drive_wio,
+ ds->dk_drive_wblk
+ );
+ return len;
+}
static int kstat_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
@@ -284,21 +300,30 @@

len += sprintf(page + len, "\ndisk_io: ");

- for (major = 0; major < DK_MAX_MAJOR; major++) {
- for (disk = 0; disk < DK_MAX_DISK; disk++) {
- int active = kstat.dk_drive[major][disk] +
- kstat.dk_drive_rblk[major][disk] +
- kstat.dk_drive_wblk[major][disk];
- if (active)
- len += sprintf(page + len,
- "(%u,%u):(%u,%u,%u,%u,%u) ",
- major, disk,
- kstat.dk_drive[major][disk],
- kstat.dk_drive_rio[major][disk],
- kstat.dk_drive_rblk[major][disk],
- kstat.dk_drive_wio[major][disk],
- kstat.dk_drive_wblk[major][disk]
- );
+ for (major = 0; major < MAX_BLKDEV; major++) {
+ struct disk_stat * ds;
+
+ if (!(blk_dev[major].queue)){
+ ds = (BLK_DEFAULT_QUEUE(major))->dk_stat;
+ if (ds)
+ len = show_disk_stat(page, len, ds, major, 0);
+ }else {
+ request_queue_t * q;
+ struct gendisk * hd = get_gendisk(MKDEV(major,0));
+ int max_disk;
+ if (!hd)
+ continue;
+ max_disk = MINORMASK>>hd->minor_shift;
+
+ for (disk = 0; disk <= max_disk; disk++) {
+ q = blk_get_queue(MKDEV(major,disk<<hd->minor_shift));
+ if (!q)
+ continue;
+ ds = q->dk_stat;
+ if (!ds)
+ continue;
+ len = show_disk_stat(page, len, ds, major,disk);
+ }
}
}

Index: v2.4/include/linux/blkdev.h
diff -u v2.4/include/linux/blkdev.h:1.1.1.1
v2.4/include/linux/blkdev.h:1.1.1.1.4.1
--- v2.4/include/linux/blkdev.h:1.1.1.1 Sun Jan 13 15:50:24 2002
+++ v2.4/include/linux/blkdev.h Mon Feb 25 22:53:10 2002
@@ -71,6 +71,13 @@
struct list_head free;
};

+struct disk_stat{
+ unsigned int dk_drive_rio;
+ unsigned int dk_drive_wio;
+ unsigned int dk_drive_rblk;
+ unsigned int dk_drive_wblk;
+};
+
struct request_queue
{
/*
@@ -122,6 +129,10 @@
* Tasks wait here for free request
*/
wait_queue_head_t wait_for_request;
+ /*
+ * statistics
+ */
+ struct disk_stat * dk_stat;
};

struct blk_dev_struct {
@@ -186,7 +197,7 @@
#define blkdev_next_request(req) blkdev_entry_to_request((req)->queue.next)
#define blkdev_prev_request(req) blkdev_entry_to_request((req)->queue.prev)

-extern void drive_stat_acct (kdev_t dev, int rw,
+extern void drive_stat_acct (struct disk_stat *, int rw,
unsigned long nr_sectors, int new_io);

static inline int get_hardsect_size(kdev_t dev)
Index: v2.4/include/linux/kernel_stat.h
diff -u v2.4/include/linux/kernel_stat.h:1.1.1.1
v2.4/include/linux/kernel_stat.h:1.1.1.1.4.1
--- v2.4/include/linux/kernel_stat.h:1.1.1.1 Sun Jan 13 15:50:24 2002
+++ v2.4/include/linux/kernel_stat.h Mon Feb 25 22:53:10 2002
@@ -19,11 +19,6 @@
unsigned int per_cpu_user[NR_CPUS],
per_cpu_nice[NR_CPUS],
per_cpu_system[NR_CPUS];
- unsigned int dk_drive[DK_MAX_MAJOR][DK_MAX_DISK];
- unsigned int dk_drive_rio[DK_MAX_MAJOR][DK_MAX_DISK];
- unsigned int dk_drive_wio[DK_MAX_MAJOR][DK_MAX_DISK];
- unsigned int dk_drive_rblk[DK_MAX_MAJOR][DK_MAX_DISK];
- unsigned int dk_drive_wblk[DK_MAX_MAJOR][DK_MAX_DISK];
unsigned int pgpgin, pgpgout;
unsigned int pswpin, pswpout;
#if !defined(CONFIG_ARCH_S390)




begin 666 disk_io-stats.dat
M26YD97@Z('8R+C0O9')I=F5R<R]B;&]C:R]L;%]R=U]B;&LN8PID:69F("UU
M('8R+C0O9')I=F5R<R]B;&]C:R]L;%]R=U]B;&LN8SHQ+C$N,2XR('8R+C0O
M9')I=F5R<R]B;&]C:R]L;%]R=U]B;&LN8SHQ+C$N,2XR+C(N,0HM+2T@=C(N
M-"]D<FEV97)S+V)L;V-K+V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@(" @(" @('!E<E]C<'5?
M;FEC95M.4E]#4%5372P*( D@(" @(" @(" @(" @<&5R7V-P=5]S>7-T96U;
M3E)?0U!54UT["BT)=6YS:6=N960@:6YT(&1K7V1R:79E6T1+7TU!6%]-04I/
M4EU;1$M?34%87T1)4TM=.PHM"75N<VEG;F5D(&EN="!D:U]D<FEV95]R:6];
M1$M?34%87TU!2D]275M$2U]-05A?1$E32UT["BT)=6YS:6=N960@:6YT(&1K
M7V1R:79E7W=I;UM$2U]-05A?34%*3U)=6T1+7TU!6%]$25-+73L*+0EU;G-I
M9VYE9"!I;G0@9&M?9')I=F5?<F)L:UM$2U]-05A?34%*3U)=6T1+7TU!6%]$
M25-+73L*+0EU;G-I9VYE9"!I;G0@9&M?9')I=F5?=V)L:UM$2U]-05A?34%*
M3U)=6T1+7TU!6%]$25-+73L*( EU;G-I9VYE9"!I;G0@<&=P9VEN+"!P9W!G
M;W5T.PH@"75N<VEG;F5D(&EN="!P<W=P:6XL('!S=W!O=70["B C:68@(61E
89FEN960H0T].1DE'7T%20TA?4S,Y,"D*
`
end

2002-03-06 22:27:18

by Alan

[permalink] [raw]
Subject: Re: [PATCH] Rework of /proc/stat

> I've made a new version of IO statistics in kstat that remove the
> previous limitations of MAX_MAJOR. I've made tests on my machine only, so could someone test it, please?
> Feedback welcome.

Any reason for preferring this over the sard patches in -ac ?

2002-03-07 01:21:44

by Mingming Cao

[permalink] [raw]
Subject: Re: [PATCH] Rework of /proc/stat

Alan Cox wrote:

>>I've made a new version of IO statistics in kstat that remove the
>>previous limitations of MAX_MAJOR. I've made tests on my machine only, so could someone test it, please?
>>Feedback welcome.
>>
>
> Any reason for preferring this over the sard patches in -ac ?
>

Basically, statistic data are moved from the global kstat structure to
the request_queue structures, and it is allocated/freed when the request
queue is initialized and freed. This way it is

1)self-controlled;
2)avoid the lookup step before the accounting, so it should be faster;
3)statistics implementation is not affected by the major/minor numbers;
4)able to gathering statistics for all disks while keep the memory needs
minimized.

2002-03-07 11:12:03

by Jean-Eric Cuendet

[permalink] [raw]
Subject: Re: [PATCH] Rework of /proc/stat

Alan Cox wrote:

>
>Any reason for preferring this over the sard patches in -ac ?
>
What does the sard patches?
What I need is to be able to get IO stats to pass them (through a home
made script) to SNMP which have no IO stats available.
Is it possible to get SARD values through /proc ? Or at least in a
simple shell script?
Thanks
-jec

--
Jean-Eric Cuendet
Linkvest SA
Av des Baumettes 19, 1020 Renens Switzerland
Tel +41 21 632 9043 Fax +41 21 632 9090
E-mail: [email protected]
http://www.linkvest.com
--------------------------------------------------------



2002-03-07 11:17:03

by Jean-Eric Cuendet

[permalink] [raw]
Subject: Re: [PATCH] Rework of /proc/stat

> Basically, statistic data are moved from the global kstat structure to
> the request_queue structures, and it is allocated/freed when the
> request queue is initialized and freed. This way it is
>
Why do you dynamically allocate the stat structure? Wouldn't it be
better static in the request struct?
You don't win anything with that since is you create the queue, it's to
be accessed, so the struct will be allocated ASAP.
No?

--
Jean-Eric Cuendet
Linkvest SA
Av des Baumettes 19, 1020 Renens Switzerland
Tel +41 21 632 9043 Fax +41 21 632 9090
E-mail: [email protected]
http://www.linkvest.com
--------------------------------------------------------



2002-03-07 11:40:48

by Jean-Eric Cuendet

[permalink] [raw]
Subject: Re: [PATCH] Rework of /proc/stat

>
>
>Any reason for preferring this over the sard patches in -ac ?
>
I just compiled 2.4.18-ac2 but there is nothing new in /proc/stat nor in
/proc/partitions...
Where is this stuff?

--
Jean-Eric Cuendet
Linkvest SA
Av des Baumettes 19, 1020 Renens Switzerland
Tel +41 21 632 9043 Fax +41 21 632 9090
E-mail: [email protected]
http://www.linkvest.com
--------------------------------------------------------



2002-03-07 11:49:39

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] Rework of /proc/stat

In article <[email protected]> you wrote:
>> Any reason for preferring this over the sard patches in -ac ?
>>
> Basically, statistic data are moved from the global kstat structure

Why do you think sard uses kstat?

> to
> the request_queue structures, and it is allocated/freed when the request
> queue is initialized and freed. This way it is

> 1)self-controlled;
> 2)avoid the lookup step before the accounting, so it should be faster;

in 2.4.18+ get_gendisk is O(1) - the lookup is not costly at all.

> 3)statistics implementation is not affected by the major/minor numbers;

Gendisks currently are per-major, which is a disadvantage, but the sard
code itself is not affected by that.

> 4)able to gathering statistics for all disks while keep the memory needs
> minimized.

The same is true for sard.

Somehow I think you haven't actually looked at the sard code in -ac..

2002-03-07 11:48:59

by Arjan van de Ven

[permalink] [raw]
Subject: Re: [PATCH] Rework of /proc/stat

Jean-Eric Cuendet wrote:
>
> Alan Cox wrote:
>
> >
> >Any reason for preferring this over the sard patches in -ac ?
> >
> What does the sard patches?
> What I need is to be able to get IO stats to pass them (through a home
> made script) to SNMP which have no IO stats available.
> Is it possible to get SARD values through /proc ? Or at least in a
> simple shell script?

yes.

man iostat

2002-03-07 12:33:28

by Alan

[permalink] [raw]
Subject: Re: [PATCH] Rework of /proc/stat

> What does the sard patches?

They collect I/O data

> What I need is to be able to get IO stats to pass them (through a home
> made script) to SNMP which have no IO stats available.
> Is it possible to get SARD values through /proc ? Or at least in a
> simple shell script?

Yes - it puts it in /proc/partitions

2002-03-07 12:36:38

by Alan

[permalink] [raw]
Subject: Re: [PATCH] Rework of /proc/stat

> I just compiled 2.4.18-ac2 but there is nothing new in /proc/stat nor in
> /proc/partitions...
> Where is this stuff?

Any Red Hat or similar kernel since 2.4.9 or so
2.4.19pre2-ac1 or later with a merge of a somewhat cleaner patch where
Christoph Hellwig uses the get/put stuff to tidy it up

major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq

3 0 5004720 hda 2619 4862 59722 50020 1390 2051 27568 66420 -1 125780
42915852
3 1 718168 hda1 4 12 32 60 0 0 0 0 0 60 60
3 2 4021920 hda2 2612 4847 59666 49890 1390 2051 27568 66420 0 43890 116310
3 3 264600 hda3 2 0 16 30 0 0 0 0 0 30 30

[Patch sent off list]

2002-03-07 13:35:35

by Alan

[permalink] [raw]
Subject: Re: [PATCH] Rework of /proc/stat

> > Any reason for preferring this over the sard patches in -ac ?
>
> Basically, statistic data are moved from the global kstat structure to
> the request_queue structures, and it is allocated/freed when the request
> queue is initialized and freed. This way it is

So does sard

2002-03-07 13:53:58

by Jean-Eric Cuendet

[permalink] [raw]
Subject: Re: [PATCH] Rework of /proc/stat

So, what could be said is that the sard (which IS in 2.4.19-per1-ac2)
has features:
- all devices available (not only major < 16)
- stat struct is in the request_queue, not in kstat anymore
- All structs are dynamic, no static allocation of per-device structs.
So, it's all we need.

The only drawback is:
- infos are in /proc/partitions not in /proc/stat (some apps get infos
there...)

Right?
-jec

PS: When will it be in official tree? An idea?

Alan Cox wrote:

>>>Any reason for preferring this over the sard patches in -ac ?
>>>
>>Basically, statistic data are moved from the global kstat structure to
>>the request_queue structures, and it is allocated/freed when the request
>>queue is initialized and freed. This way it is
>>
>
>So does sard
>

--
Jean-Eric Cuendet
Linkvest SA
Av des Baumettes 19, 1020 Renens Switzerland
Tel +41 21 632 9043 Fax +41 21 632 9090
E-mail: [email protected]
http://www.linkvest.com
--------------------------------------------------------



2002-03-07 14:03:02

by Alan

[permalink] [raw]
Subject: Re: [PATCH] Rework of /proc/stat

> The only drawback is:
> - infos are in /proc/partitions not in /proc/stat (some apps get infos
> there...)
> Right?

Yes - proc/stat doesn't have the fields to provide enough (and per
partition) info.

> PS: When will it be in official tree? An idea?

I hope to feed it to Marcelo for 2.4.19

2002-03-13 16:41:53

by Jean-Eric Cuendet

[permalink] [raw]
Subject: Re: [PATCH] Rework of /proc/stat


Alan Cox wrote:

>Normal for md (/proc/mdstat). Interesting question whether they should be
>there - see what Ingo thinks
>
Ingo? What do you think?

When I cat /proc/partitions, all partitions are there with IO stats but
MD or LVM have no IO stats.
Shouldn't it be there?

--
Jean-Eric Cuendet
Linkvest SA
Av des Baumettes 19, 1020 Renens Switzerland
Tel +41 21 632 9043 Fax +41 21 632 9090
E-mail: [email protected]
http://www.linkvest.com
--------------------------------------------------------