patch-2.3.26 linux/mm/page_alloc.c

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

diff -u --recursive --new-file v2.3.25/linux/mm/page_alloc.c linux/mm/page_alloc.c
@@ -262,11 +262,11 @@
 		}
 		low_on_highmemory = 1;
 	} else {
-		if (nr_free_pages+nr_free_highpages > freepages.min) {
+		if (nr_free_pages-nr_free_highpages > freepages.min) {
 			if (!low_on_memory) {
 				return 1;
 			}
-			if (nr_free_pages+nr_free_highpages >= freepages.high) {
+			if (nr_free_pages-nr_free_highpages >= freepages.high) {
 				low_on_memory = 0;
 				return 1;
 			}
@@ -320,6 +320,10 @@
 	do {
 		page = rmqueue(order, type);
 		if (page) {
+#ifdef CONFIG_HIGHMEM
+			if (type == MEM_TYPE_HIGH)
+				nr_free_highpages -= 1 << order;
+#endif
 			spin_unlock_irqrestore(&page_alloc_lock, flags);
 			return page;
 		}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)