[PATCH] swap 1/4 swapon memleak

From: Hugh Dickins (hugh@veritas.com)
Date: Tue Jun 11 2002 - 22:03:03 EST


Burton reported Kernel memory leak with swapon/swapoff? LKML 31 May.
swapon uses rw_swap_page_nolock to read swap_header page (peculiar!
should probably rework that sometime), nothing freed the buffers
from the page, and thus the page was also never freed.

--- 2.4.19-pre10/mm/page_io.c Mon Nov 19 23:19:42 2001
+++ linux/mm/page_io.c Tue Jun 11 19:02:30 2002
@@ -120,8 +120,10 @@
                 PAGE_BUG(page);
         /* needs sync_page to wait I/O completation */
         page->mapping = &swapper_space;
- if (!rw_swap_page_base(rw, entry, page))
- UnlockPage(page);
- wait_on_page(page);
+ if (rw_swap_page_base(rw, entry, page))
+ lock_page(page);
+ if (!block_flushpage(page, 0))
+ PAGE_BUG(page);
         page->mapping = NULL;
+ UnlockPage(page);
 }

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



This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:24 EST