[PATCH] swap 1/4 swapon memleak

Hugh Dickins (hugh@veritas.com)
Wed, 12 Jun 2002 04:03:03 +0100 (BST)


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/