patch-2.0.32 linux/mm/filemap.c

Next file: linux/mm/kmalloc.c
Previous file: linux/kernel/time.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.31/linux/mm/filemap.c linux/mm/filemap.c
@@ -114,7 +114,7 @@
 	}
 }
 
-int shrink_mmap(int priority, int dma, int can_do_io)
+int shrink_mmap(int priority, int dma, int free_buf)
 {
 	static int clock = 0;
 	struct page * page;
@@ -174,7 +174,7 @@
 				}
 
 				/* is it a buffer cache page? */
-				if (can_do_io && bh && try_to_free_buffer(bh, &bh, 6))
+				if (free_buf && bh && try_to_free_buffer(bh, &bh, 6))
 					return 1;
 				break;
 
@@ -662,8 +662,15 @@
 		pos += nr;
 		read += nr;
 		count -= nr;
-		if (count)
+		if (count) {
+			/*
+			 * to prevent hogging the CPU on well-cached systems,
+			 * schedule if needed, it's safe to do it here:
+			 */
+			if (need_resched)
+				schedule();
 			continue;
+		}
 		break;
 	}
 

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