diff -u 2.4/mm/page_alloc.c build-2.4/mm/page_alloc.c --- 2.4/mm/page_alloc.c Sat May 26 10:06:29 2001 +++ build-2.4/mm/page_alloc.c Sun May 27 14:18:35 2001 @@ -141,8 +141,11 @@ * since it's nothing important, but we do want to make sure * it never gets negative. */ - if (memory_pressure > NR_CPUS) - memory_pressure--; + { + int mp = memory_pressure-(1< 0) + memory_pressure = mp; + } } #define MARK_USED(index, order, area) \ @@ -282,7 +285,7 @@ /* * Allocations put pressure on the VM subsystem. */ - memory_pressure++; + memory_pressure += (1<free_pages < z->pages_min / 4 && - !(current->flags & PF_MEMALLOC)) + (in_interrupt() || !(current->flags & PF_MEMALLOC))) continue; page = rmqueue(z, order); if (page) diff -u 2.4/mm/swap.c build-2.4/mm/swap.c --- 2.4/mm/swap.c Mon Jan 22 22:30:21 2001 +++ build-2.4/mm/swap.c Sun May 27 14:24:29 2001 @@ -46,8 +46,19 @@ * is doing, averaged over a minute. We use this to determine how * many inactive pages we should have. * - * In reclaim_page and __alloc_pages: memory_pressure++ + * In __alloc_pages: memory_pressure++ + * each allocation uses memory * In __free_pages_ok: memory_pressure-- + * kreclaimd: memory_pressure++ before __free_pages_ok + * A memory free from outside of the {in,}active_list + * reduces the necessary number of freeable pages in the + * inactive_clean_list. + * in reclaim_pages: memory_pressure++ for each unfreeable page found + * in the inactive_clean_list. + * Pages in the inactive_clean_list can be reused by the current + * owner. This "increases" the memory pressure since more pages + * must be in the inactive_clean_list to have a certain number of + * freeable pages in the inactive_clean_list. * In recalculate_vm_stats the value is decayed (once a second) */ int memory_pressure; diff -u 2.4/mm/vmscan.c build-2.4/mm/vmscan.c --- 2.4/mm/vmscan.c Sat May 26 10:06:29 2001 +++ build-2.4/mm/vmscan.c Sun May 27 14:27:23 2001 @@ -355,6 +355,7 @@ printk("VM: reclaim_page, wrong page on list.\n"); list_del(page_lru); page->zone->inactive_clean_pages--; + memory_pressure++; continue; } @@ -363,6 +364,7 @@ (!page->buffers && page_count(page) > 1)) { del_page_from_inactive_clean_list(page); add_page_to_active_list(page); + memory_pressure++; continue; } @@ -370,6 +372,7 @@ if (page->buffers || PageDirty(page) || TryLockPage(page)) { del_page_from_inactive_clean_list(page); add_page_to_inactive_dirty_list(page); + memory_pressure++; continue; } @@ -389,6 +392,7 @@ list_del(page_lru); zone->inactive_clean_pages--; UnlockPage(page); + memory_pressure++; } /* Reset page pointer, maybe we encountered an unfreeable page. */ page = NULL; @@ -404,7 +408,6 @@ out: spin_unlock(&pagemap_lru_lock); spin_unlock(&pagecache_lock); - memory_pressure++; return page; } @@ -1046,6 +1049,14 @@ page = reclaim_page(zone); if (!page) break; + /* We move pages from the inactive_clean_list + * into the buddy. This doesn't cause any change + * in the actual memory pressure. + * The 'memory_pressure++' is + * required to undo the 'memory_pressure--' + * in __free_pages_ok. + */ + memory_pressure++; __free_page(page); } }