diff -urN linux-2.4.0-t7-p4-vm.bak/fs/proc/proc_misc.c linux-2.4.0-t7-p4-vm/fs/proc/proc_misc.c --- linux-2.4.0-t7-p4-vm.bak/fs/proc/proc_misc.c Thu Aug 17 01:29:37 2000 +++ linux-2.4.0-t7-p4-vm/fs/proc/proc_misc.c Wed Aug 16 23:49:30 2000 @@ -63,6 +63,7 @@ extern int get_irq_list(char *); extern int get_dma_list(char *); extern int get_locks_status (char *, char **, off_t, int); +extern int get_zoneinfo (char *, char **, off_t, int); extern int get_swaparea_info (char *); #ifdef CONFIG_SGI_DS1286 extern int get_ds1286_status(char *); @@ -289,6 +290,18 @@ } #endif +static int zoneinfo_read_proc(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + int len = get_zoneinfo(page, start, off, count); + len -= (*start-page); + if (len <= count) + *eof = 1; + if (len > count) len = count; + if (len < 0) len = 0; + return len; +} + static int kstat_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -639,6 +652,7 @@ {"swaps", swaps_read_proc}, {"iomem", memory_read_proc}, {"execdomains", execdomains_read_proc}, + {"zoneinfo", zoneinfo_read_proc}, {NULL,NULL} }; for(p=simple_ones;p->name;p++) @@ -676,5 +690,5 @@ res->read_proc = slabinfo_read_proc; res->write_proc = slabinfo_write_proc; } - } + } } diff -urN linux-2.4.0-t7-p4-vm.bak/mm/page_alloc.c linux-2.4.0-t7-p4-vm/mm/page_alloc.c --- linux-2.4.0-t7-p4-vm.bak/mm/page_alloc.c Thu Aug 17 01:29:37 2000 +++ linux-2.4.0-t7-p4-vm/mm/page_alloc.c Thu Aug 17 00:14:30 2000 @@ -659,6 +659,7 @@ zonelist->zones[j++] = zone; } case ZONE_NORMAL: + zone = pgdat->node_zones + ZONE_NORMAL; if (zone->size) zonelist->zones[j++] = zone; @@ -828,5 +829,40 @@ printk("\n"); return 1; } + +#ifdef CONFIG_PROC_FS +int get_zoneinfo (char*page, char**start, off_t off, int count) +{ + pg_data_t *pgdat = NODE_DATA(0); + int i,j; unsigned long flags; + int len = 0; + + for (i = 0; i < MAX_NR_ZONES; i++) { + zonelist_t *zonelist; + zone_t **zone; + + zonelist = pgdat->node_zonelists + i; + + zone = zonelist->zones; + for (j = 0;;j++) { + zone_t *z = *(zone++); + if (!z) + break; + if (!z->size) + BUG(); + + spin_lock_irqsave(&z->lock, flags); + + len += sprintf(page+len, "%4u %4u %6lu %6lu %6lu %6lu %6lu %6lu %6lu\n", + i,j,z->offset, z->free_pages, z->inactive_clean_pages, + z->inactive_dirty_pages, z->pages_min, z->pages_low, z->pages_high); + + spin_unlock_irqrestore(&z->lock, flags); + } + } + *start = page+off; + return len; +} +#endif __setup("memfrac=", setup_mem_frac);