patch-2.1.79 linux/mm/page_alloc.c

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

diff -u --recursive --new-file v2.1.78/linux/mm/page_alloc.c linux/mm/page_alloc.c
@@ -133,9 +133,12 @@
 void __free_page(struct page *page)
 {
 	if (!PageReserved(page) && atomic_dec_and_test(&page->count)) {
-		delete_from_swap_cache(page);
+		if (PageSwapCache(page))
+			panic ("Freeing swap cache page");
 		free_pages_ok(page->map_nr, 0);
 	}
+	if (PageSwapCache(page) && atomic_read(&page->count) == 1)
+		panic ("Releasing swap cache page");
 }
 
 void free_pages(unsigned long addr, unsigned long order)
@@ -147,10 +150,14 @@
 		if (PageReserved(map))
 			return;
 		if (atomic_dec_and_test(&map->count)) {
-			delete_from_swap_cache(map);
+			if (PageSwapCache(map))
+				panic ("Freeing swap cache pages");
 			free_pages_ok(map_nr, order);
 			return;
 		}
+		if (PageSwapCache(map) && atomic_read(&map->count) == 1)
+			panic ("Releasing swap cache pages at %p",
+			       __builtin_return_address(0));
 	}
 }
 

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