patch-2.0.28 linux/mm/vmscan.c

Next file: linux/CREDITS
Previous file: linux/mm/swapfile.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.27/linux/mm/vmscan.c linux/mm/vmscan.c
@@ -108,13 +108,8 @@
 		} else {
 			if (page_map->count != 1)
 				return 0;
-			if (!(entry = get_swap_page())) {
-				/* Aieee!!! Out of swap space! */
-				int retval = -1;
-				if (nr_swapfiles == 0)
-					retval = 0;
-				return retval;
-			}
+			if (!(entry = get_swap_page()))
+				return 0;
 			vma->vm_mm->rss--;
 			flush_cache_page(vma, address);
 			set_pte(page_table, __pte(entry));
@@ -317,9 +312,6 @@
 		if (!--p->swap_cnt)
 			swap_task++;
 		switch (swap_out_process(p, dma, wait)) {
-			/* out of swap space? */
-			case -1:
-				return 0;
 			case 0:
 				if (p->swap_cnt)
 					swap_task++;
@@ -428,9 +420,22 @@
 
 void swap_tick(void)
 {
-	if ((nr_free_pages + nr_async_pages) < free_pages_low ||
-	    ((nr_free_pages + nr_async_pages) < free_pages_high && 
-	     jiffies >= next_swap_jiffies)) {
+	int	want_wakeup = 0;
+	static int	last_wakeup_low = 0;
+
+	if ((nr_free_pages + nr_async_pages) < free_pages_low) {
+		if (last_wakeup_low)
+			want_wakeup = jiffies >= next_swap_jiffies;
+		else
+			last_wakeup_low = want_wakeup = 1;
+	}
+	else if (((nr_free_pages + nr_async_pages) < free_pages_high) && 
+	         jiffies >= next_swap_jiffies) {
+		last_wakeup_low = 0;
+		want_wakeup = 1;
+	}
+
+	if (want_wakeup) {
 		if (!kswapd_awake && kswapd_ctl.maxpages > 0) {
 			wake_up(&kswapd_wait);
 			need_resched = 1;


FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov