--- ./mm/swap.c Sat Nov 24 23:59:28 2001 +++ /usr/src/linux/./mm/swap.c Sun Dec 30 14:26:45 2001 @@ -36,7 +36,7 @@ /* * Move an inactive page to the active list. */ -static inline void activate_page_nolock(struct page * page) +void activate_page_nolock(struct page * page) { if (PageLRU(page) && !PageActive(page)) { del_page_from_inactive_list(page); --- ./mm/vmscan.c Sat Dec 22 09:35:54 2001 +++ /usr/src/linux/./mm/vmscan.c Sun Dec 30 23:40:10 2001 @@ -394,9 +394,9 @@ if (PageDirty(page) && is_page_cache_freeable(page) && page->mapping) { /* * It is not critical here to write it only if - * the page is unmapped beause any direct writer + * the page is unmapped because any direct writer * like O_DIRECT would set the PG_dirty bitflag - * on the phisical page after having successfully + * on the physical page after having successfully * pinned it and after the I/O to the page is finished, * so the direct writes to the page cannot get lost. */ @@ -480,11 +480,12 @@ /* * Alert! We've found too many mapped pages on the - * inactive list, so we start swapping out now! + * inactive list. + * Move referenced pages to the active list. */ - spin_unlock(&pagemap_lru_lock); - swap_out(priority, gfp_mask, classzone); - return nr_pages; + if (PageReferenced(page)) + activate_page_nolock(page); + continue; } /* @@ -521,6 +522,9 @@ } spin_unlock(&pagemap_lru_lock); + if (max_mapped <= 0 && nr_pages > 0) + swap_out(priority, gfp_mask, classzone); + return nr_pages; } --- ./include/linux/swap.h Sat Nov 24 23:59:24 2001 +++ /usr/src/linux/./include/linux/swap.h Sun Dec 30 15:01:21 2001 @@ -106,6 +106,7 @@ extern void FASTCALL(lru_cache_del(struct page *)); extern void FASTCALL(activate_page(struct page *)); +extern void FASTCALL(activate_page_nolock(struct page *)); extern void swap_setup(void);