diff -urN oldtree/fs/buffer.c newtree/fs/buffer.c --- oldtree/fs/buffer.c 2006-09-24 17:03:56.000000000 -0400 +++ newtree/fs/buffer.c 2006-09-26 15:17:40.000000000 -0400 @@ -371,7 +371,7 @@ for_each_online_pgdat(pgdat) { zones = pgdat->node_zonelists[gfp_zone(GFP_NOFS)].zones; if (*zones) - try_to_free_pages(zones, GFP_NOFS); + try_to_free_pages(zones, GFP_NOFS, NULL); } } diff -urN oldtree/include/linux/swap.h newtree/include/linux/swap.h --- oldtree/include/linux/swap.h 2006-09-26 15:14:04.000000000 -0400 +++ newtree/include/linux/swap.h 2006-09-26 15:17:40.000000000 -0400 @@ -187,7 +187,8 @@ extern void swap_setup(void); /* linux/mm/vmscan.c */ -extern unsigned long try_to_free_pages(struct zone **, gfp_t); +extern unsigned long try_to_free_pages(struct zone **, gfp_t, + struct task_struct *p); extern unsigned long shrink_all_memory(unsigned long nr_pages); extern int vm_mapped; extern int vm_hardmaplimit; diff -urN oldtree/mm/page_alloc.c newtree/mm/page_alloc.c --- oldtree/mm/page_alloc.c 2006-09-26 15:17:19.000000000 -0400 +++ newtree/mm/page_alloc.c 2006-09-26 15:17:40.000000000 -0400 @@ -1134,7 +1134,7 @@ reclaim_state.reclaimed_slab = 0; p->reclaim_state = &reclaim_state; - did_some_progress = try_to_free_pages(zonelist->zones, gfp_mask); + did_some_progress = try_to_free_pages(zonelist->zones, gfp_mask, p); p->reclaim_state = NULL; p->flags &= ~PF_MEMALLOC; diff -urN oldtree/mm/vmscan.c newtree/mm/vmscan.c --- oldtree/mm/vmscan.c 2006-09-26 15:17:19.000000000 -0400 +++ newtree/mm/vmscan.c 2006-09-26 15:26:43.000000000 -0400 @@ -1036,7 +1036,8 @@ * holds filesystem locks which prevent writeout this might not work, and the * allocation attempt will fail. */ -unsigned long try_to_free_pages(struct zone **zones, gfp_t gfp_mask) +unsigned long try_to_free_pages(struct zone **zones, gfp_t gfp_mask, + struct task_struct *p) { int priority; int ret = 0; @@ -1044,7 +1045,7 @@ unsigned long nr_reclaimed = 0; struct reclaim_state *reclaim_state = current->reclaim_state; unsigned long lru_pages = 0; - int i; + int i, scan_priority = DEF_PRIORITY; struct scan_control sc = { .gfp_mask = gfp_mask, .may_writepage = !laptop_mode, @@ -1062,11 +1063,11 @@ if (!cpuset_zone_allowed(zone, __GFP_HARDWALL)) continue; - zone->temp_priority = DEF_PRIORITY; + zone->temp_priority = scan_priority; lru_pages += zone->nr_active + zone->nr_inactive; } - for (priority = DEF_PRIORITY; priority >= 0; priority--) { + for (priority = scan_priority; priority >= 0; priority--) { sc.nr_scanned = 0; if (!priority) disable_swap_token(); @@ -1096,7 +1097,7 @@ } /* Take a nap, wait for some writeback to complete */ - if (sc.nr_scanned && priority < DEF_PRIORITY - 2) + if (sc.nr_scanned && priority < scan_priority - 2) blk_congestion_wait(WRITE, HZ/10); } /* top priority shrink_caches still had more to do? don't OOM, then */ @@ -1137,9 +1138,9 @@ */ static unsigned long balance_pgdat(pg_data_t *pgdat, int order) { - int all_zones_ok; + int all_zones_ok = 0; int priority; - int i; + int i, scan_priority; unsigned long total_scanned; unsigned long nr_reclaimed; struct reclaim_state *reclaim_state = current->reclaim_state; @@ -1150,6 +1151,8 @@ .mapped = vm_mapped, }; + scan_priority = sc_priority(pgdat->kswapd); + loop_again: total_scanned = 0; nr_reclaimed = 0; @@ -1159,10 +1162,10 @@ for (i = 0; i < pgdat->nr_zones; i++) { struct zone *zone = pgdat->node_zones + i; - zone->temp_priority = DEF_PRIORITY; + zone->temp_priority = scan_priority; } - for (priority = DEF_PRIORITY; priority >= 0; priority--) { + for (priority = scan_priority; priority >= 0; priority--) { int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */ unsigned long lru_pages = 0; @@ -1183,7 +1186,7 @@ if (!populated_zone(zone)) continue; - if (zone->all_unreclaimable && priority != DEF_PRIORITY) + if (zone->all_unreclaimable && priority != scan_priority) continue; /* @@ -1192,7 +1195,7 @@ * pages_high. */ watermark = zone->pages_high + (zone->pages_high * - priority / DEF_PRIORITY); + priority / scan_priority); if (!zone_watermark_ok(zone, order, watermark, 0, 0)) { end_zone = i; goto scan; @@ -1224,11 +1227,11 @@ if (!populated_zone(zone)) continue; - if (zone->all_unreclaimable && priority != DEF_PRIORITY) + if (zone->all_unreclaimable && priority != scan_priority) continue; watermark = zone->pages_high + (zone->pages_high * - priority / DEF_PRIORITY); + priority / scan_priority); if (!zone_watermark_ok(zone, order, watermark, end_zone, 0)) @@ -1263,7 +1266,7 @@ * OK, kswapd is getting into trouble. Take a nap, then take * another pass across the zones. */ - if (total_scanned && priority < DEF_PRIORITY - 2) + if (total_scanned && priority < scan_priority - 2) blk_congestion_wait(WRITE, HZ/10); /* @@ -1452,6 +1455,9 @@ .mapped = vm_mapped, }; + if (p) + scan_priority = sc_priority(p); + delay_swap_prefetch(); current->reclaim_state = &reclaim_state; Files oldtree/scripts/kconfig/mconf and newtree/scripts/kconfig/mconf differ