patch-pre2.0.5 linux/mm/filemap.c

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

diff -u --recursive --new-file pre2.0.4/linux/mm/filemap.c linux/mm/filemap.c
@@ -117,11 +117,17 @@
 	struct page * page;
 	unsigned long limit = MAP_NR(high_memory);
 	struct buffer_head *tmp, *bh;
+	int count_max, count_min;
+
+	count_max = (limit<<1) >> (priority>>1);
+	count_min = (limit<<1) >> (priority);
 
-	priority = (limit<<2) >> priority;
 	page = mem_map + clock;
 	do {
-		priority--;
+		count_max--;
+		if (page->inode || page->buffers)
+			count_min--;
+
 		if (PageLocked(page))
 			goto next;
 		if (dma && !PageDMA(page))
@@ -179,7 +185,7 @@
 			clock = 0;
 			page = mem_map;
 		}
-	} while (priority > 0);
+	} while (count_max > 0 && count_min > 0);
 	return 0;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this