diff -u --recursive --new-file v2.1.32/linux/include/linux/swapctl.h linux/include/linux/swapctl.h --- v2.1.32/linux/include/linux/swapctl.h Thu Feb 6 02:54:09 1997 +++ linux/include/linux/swapctl.h Wed Apr 9 23:31:26 1997 @@ -31,17 +31,6 @@ typedef struct swap_control_v5 swap_control_t; extern swap_control_t swap_control; -typedef struct kswapd_control_v1 -{ - unsigned int maxpages; - unsigned int pages_buff; - unsigned int pages_shm; - unsigned int pages_mmap; - unsigned int pages_swap; -} kswapd_control_v1; -typedef kswapd_control_v1 kswapd_control_t; -extern kswapd_control_t kswapd_ctl; - typedef struct swapstat_v1 { unsigned int wakeups; diff -u --recursive --new-file v2.1.32/linux/kernel/sysctl.c linux/kernel/sysctl.c --- v2.1.32/linux/kernel/sysctl.c Mon Apr 7 11:35:32 1997 +++ linux/kernel/sysctl.c Tue Apr 8 09:43:01 1997 @@ -183,10 +183,6 @@ static ctl_table vm_table[] = { {VM_SWAPCTL, "swapctl", &swap_control, sizeof(swap_control_t), 0600, NULL, &proc_dointvec}, - {VM_KSWAPD, "kswapd", - &kswapd_ctl, sizeof(kswapd_ctl), 0600, NULL, &proc_dointvec}, - {VM_SWAPOUT, "kswapd-interval", - &swapout_interval, sizeof(int), 0600, NULL, &proc_dointvec}, {VM_FREEPG, "freepages", &min_free_pages, 3*sizeof(int), 0600, NULL, &proc_dointvec}, {VM_BDFLUSH, "bdflush", &bdf_prm, 9*sizeof(int), 0600, NULL, diff -u --recursive --new-file v2.1.32/linux/mm/vmscan.c linux/mm/vmscan.c --- v2.1.32/linux/mm/vmscan.c Sun Jan 26 02:07:50 1997 +++ linux/mm/vmscan.c Tue Apr 8 09:39:27 1997 @@ -5,6 +5,8 @@ * * Swap reorganised 29.12.95, Stephen Tweedie. * kswapd added: 7.1.96 sct + * Removed kswapd_ctl limits, and swap out as many pages as needed + * to bring the system back to free_pages_high: 2.4.97, Rik van Riel. * Version: $Id: vmscan.c,v 1.21 1997/01/06 06:54:03 davem Exp $ */ @@ -49,12 +51,6 @@ */ static int kswapd_awake = 0; -/* - * sysctl-modifiable parameters to control the aggressiveness of the - * page-searching within the kswapd page recovery daemon. - */ -kswapd_control_t kswapd_ctl = {4, -1, -1, -1, -1}; - static void init_swap_timer(void); /* @@ -409,8 +405,16 @@ interruptible_sleep_on(&kswapd_wait); kswapd_awake = 1; swapstats.wakeups++; - /* Do the background pageout: */ - for (i=0; i < kswapd_ctl.maxpages; i++) + /* Do the background pageout: + * We now only swap out as many pages as needed. + * When we are truly low on memory, we swap out + * synchronously (WAIT == 1). -- Rik. + */ + while(nr_free_pages < min_free_pages) + try_to_free_page(GFP_KERNEL, 0, 1); + while((nr_free_pages + nr_async_pages) < free_pages_low) + try_to_free_page(GFP_KERNEL, 0, 1); + while((nr_free_pages + nr_async_pages) < free_pages_high) try_to_free_page(GFP_KERNEL, 0, 0); } } @@ -436,12 +440,16 @@ want_wakeup = 1; } - if (want_wakeup) { - if (!kswapd_awake && kswapd_ctl.maxpages > 0) { + if (want_wakeup) { + if (!kswapd_awake) { wake_up(&kswapd_wait); need_resched = 1; } - next_swap_jiffies = jiffies + swapout_interval; + /* low on memory, we need to start swapping soon */ + if(last_wakeup_low) + next_swap_jiffies = jiffies; + else + next_swap_jiffies = jiffies + swapout_interval; } timer_active |= (1<