[patch] 2.2.0-pre5 FreeAfter() check missing

Andrea Arcangeli (andrea@e-mind.com)
Fri, 8 Jan 1999 12:15:39 +0100 (CET)


2.2.0-pre5 doesn't check if the page is under async swapout before
do a COW. I think it was not harming because shrink_mmap() should be able
to shrink the orphaned swap cache page. But here the fix:

Index: memory.c
===================================================================
RCS file: /var/cvs/linux/mm/memory.c,v
retrieving revision 1.1.1.1.2.8
diff -u -r1.1.1.1.2.8 memory.c
--- memory.c 1999/01/07 11:57:23 1.1.1.1.2.8
+++ memory.c 1999/01/08 11:07:03
@@ -625,6 +625,7 @@
pte_t pte;
unsigned long old_page, new_page;
struct page * page_map;
+ int count;

pte = *page_table;
new_page = __get_free_page(GFP_USER);
@@ -649,7 +650,9 @@
* in which case we can remove the page
* from the swap cache.
*/
- switch (atomic_read(&page_map->count)) {
+ count = atomic_read(&page_map->count);
+ if (PageFreeAfter(page_map)) count--;
+ switch (count) {
case 2:
if (!PageSwapCache(page_map))
break;

Andrea Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/