diff -urN -X dontdiff linux-2.4.0/mm/page_alloc.c markhe-2.4.0/mm/page_alloc.c --- linux-2.4.0/mm/page_alloc.c Wed Jan 3 17:59:06 2001 +++ markhe-2.4.0/mm/page_alloc.c Mon Jan 15 15:35:14 2001 @@ -583,6 +583,27 @@ } /* + * Free pages in zone "type", and the zones below it. + */ +unsigned int nr_free_pages_zone (int type) +{ + unsigned int sum; + zone_t *zone; + pg_data_t *pgdat = pgdat_list; + + if (type >= MAX_NR_ZONES) + BUG(); + + sum = 0; + while (pgdat) { + for (zone = pgdat->node_zones; zone < pgdat->node_zones + type; zone++) + sum += zone->free_pages; + pgdat = pgdat->node_next; + } + return sum; +} + +/* * Total amount of inactive_clean (allocatable) RAM: */ unsigned int nr_inactive_clean_pages (void) @@ -600,6 +621,25 @@ return sum; } +unsigned int nr_inactive_clean_pages_zone(int type) +{ + unsigned int sum; + zone_t *zone; + pg_data_t *pgdat = pgdat_list; + + if (type >= MAX_NR_ZONES) + BUG(); + type++; + + sum = 0; + while (pgdat) { + for (zone = pgdat->node_zones; zone < pgdat->node_zones + type; zone++) + sum += zone->inactive_clean_pages; + pgdat = pgdat->node_next; + } + return sum; +} + /* * Amount of free RAM allocatable as buffer memory: */ @@ -607,9 +647,9 @@ { unsigned int sum; - sum = nr_free_pages(); - sum += nr_inactive_clean_pages(); - sum += nr_inactive_dirty_pages; + sum = nr_free_pages_zone(ZONE_NORMAL); + sum += nr_inactive_clean_pages_zone(ZONE_NORMAL); + sum += nr_inactive_dirty_pages; /* XXX */ /* * Keep our write behind queue filled, even if