[PATCH][2.4] Miniscule block and kstat optimisation
From: Alan Swanson
Date: Tue Jan 20 2004 - 14:42:32 EST
Involving a (very) tiny speed-up in ll_rw_blk, by shifting the
calculation to proc, and saving memory from a now unused array.
It's basically a very small subset of my diskio patch for /proc/stat in
the 2.4 kernel.
Can someone pass this to Marcelo as there are no real maintainers for
the files touched. I've tried submitting directly but without response.
--
Alan.
"One must never be purposelessnessnesslessness."
diff -ur linux-2.4.23-pre3/drivers/block/ll_rw_blk.c linux-2.4.23-pre3-kstat/drivers/block/ll_rw_blk.c
--- linux-2.4.23-pre3/drivers/block/ll_rw_blk.c 2003-11-28 21:27:25.000000000 +0000
+++ linux-2.4.23-pre3-kstat/drivers/block/ll_rw_blk.c 2003-12-31 15:52:48.000000000 +0000
@@ -701,7 +701,6 @@
if ((index >= DK_MAX_DISK) || (major >= DK_MAX_MAJOR))
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;
diff -ur linux-2.4.23-pre3/fs/proc/proc_misc.c linux-2.4.23-pre3-kstat/fs/proc/proc_misc.c
--- linux-2.4.23-pre3/fs/proc/proc_misc.c 2003-11-28 21:27:28.000000000 +0000
+++ linux-2.4.23-pre3-kstat/fs/proc/proc_misc.c 2003-12-31 15:52:48.000000000 +0000
@@ -357,14 +357,16 @@
for (major = 0; major < DK_MAX_MAJOR; major++) {
for (disk = 0; disk < DK_MAX_DISK; disk++) {
- int active = kstat.dk_drive[major][disk] +
+ int active = kstat.dk_drive_rio[major][disk] +
+ kstat.dk_drive_wio[major][disk] +
kstat.dk_drive_rblk[major][disk] +
kstat.dk_drive_wblk[major][disk];
if (active)
proc_sprintf(page, &off, &len,
"(%u,%u):(%u,%u,%u,%u,%u) ",
major, disk,
- kstat.dk_drive[major][disk],
+ kstat.dk_drive_rio[major][disk] +
+ kstat.dk_drive_wio[major][disk],
kstat.dk_drive_rio[major][disk],
kstat.dk_drive_rblk[major][disk],
kstat.dk_drive_wio[major][disk],
diff -ur linux-2.4.23-pre3/include/linux/kernel_stat.h linux-2.4.23-pre3-kstat/include/linux/kernel_stat.h
--- linux-2.4.23-pre3/include/linux/kernel_stat.h 2003-06-13 22:15:13.000000000 +0100
+++ linux-2.4.23-pre3-kstat/include/linux/kernel_stat.h 2003-12-31 15:52:48.000000000 +0000
@@ -19,7 +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];
Attachment:
signature.asc
Description: This is a digitally signed message part