Re: [RFC][PATCH 1/3] radix priority search tree - objrmapcomplexity fix

From: Andrew Morton
Date: Mon Mar 29 2004 - 17:45:56 EST


Andrea Arcangeli <andrea@xxxxxxx> wrote:
>
> On Mon, Mar 29, 2004 at 12:40:27PM -0800, Andrew Morton wrote:
> > Andrea Arcangeli <andrea@xxxxxxx> wrote:
> > >
> > > There's now also a screwup in the writeback -mm changes for swapsuspend,
> > > it bugs out in radix tree tag, I believe it's because it doesn't
> > > insert the page in the radix tree before doing writeback I/O on it.
> >
> > hmm, yes, we have pages which satisfy PageSwapCache(), but which are not
> > actually in swapcache.
>
> exactly.
>
> > How about we use the normal pagecache APIs for this?
>
> should work fine too and it exposes less internal vm details. I will
> propose your fix for testing too.

As Hugh points out, it was missing a page_cache_release().


25-akpm/mm/page_io.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)

diff -puN mm/page_io.c~rw_swap_page_sync-fix mm/page_io.c
--- 25/mm/page_io.c~rw_swap_page_sync-fix Mon Mar 29 14:41:08 2004
+++ 25-akpm/mm/page_io.c Mon Mar 29 14:41:28 2004
@@ -139,7 +139,7 @@ struct address_space_operations swap_aop

/*
* A scruffy utility function to read or write an arbitrary swap page
- * and wait on the I/O.
+ * and wait on the I/O. The caller must have a ref on the page.
*/
int rw_swap_page_sync(int rw, swp_entry_t entry, struct page *page)
{
@@ -151,8 +151,7 @@ int rw_swap_page_sync(int rw, swp_entry_
lock_page(page);

BUG_ON(page->mapping);
- page->mapping = &swapper_space;
- page->index = entry.val;
+ add_to_page_cache(page, &swapper_space, entry.val, GFP_NOIO);

if (rw == READ) {
ret = swap_readpage(NULL, page);
@@ -161,7 +160,12 @@ int rw_swap_page_sync(int rw, swp_entry_
ret = swap_writepage(page, &swap_wbc);
wait_on_page_writeback(page);
}
- page->mapping = NULL;
+
+ lock_page(page);
+ remove_from_page_cache(page);
+ unlock_page(page);
+ page_cache_release(page); /* For add_to_page_cache() */
+
if (ret == 0 && (!PageUptodate(page) || PageError(page)))
ret = -EIO;
return ret;

_

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