2009-12-02 04:37:59

by Fengguang Wu

[permalink] [raw]
Subject: [PATCH 02/24] migrate: page could be locked by hwpoison, dont BUG()

The new page could be taken by hwpoison, in which case
return EAGAIN to allocate a new page and retry.

CC: Nick Piggin <[email protected]>
CC: Christoph Lameter <[email protected]>
CC: KAMEZAWA Hiroyuki <[email protected]>
Signed-off-by: Wu Fengguang <[email protected]>
---
mm/migrate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-mm.orig/mm/migrate.c 2009-11-02 10:18:45.000000000 +0800
+++ linux-mm/mm/migrate.c 2009-11-02 10:26:16.000000000 +0800
@@ -556,7 +556,7 @@ static int move_to_new_page(struct page
* holding a reference to the new page at this point.
*/
if (!trylock_page(newpage))
- BUG();
+ return -EAGAIN; /* got by hwpoison */

/* Prepare mapping for the new page.*/
newpage->index = page->index;


2009-12-02 13:09:00

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH 02/24] migrate: page could be locked by hwpoison, dont BUG()

On Wed, Dec 02, 2009 at 11:12:33AM +0800, Wu Fengguang wrote:
> The new page could be taken by hwpoison, in which case
> return EAGAIN to allocate a new page and retry.

Previously there were some complaints about this patch, but I guess
it doesn't hurt, so I'll add it.

-Andi

2009-12-02 14:50:31

by Christoph Lameter

[permalink] [raw]
Subject: Re: [PATCH 02/24] migrate: page could be locked by hwpoison, dont BUG()

On Wed, 2 Dec 2009, Wu Fengguang wrote:

> mm/migrate.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- linux-mm.orig/mm/migrate.c 2009-11-02 10:18:45.000000000 +0800
> +++ linux-mm/mm/migrate.c 2009-11-02 10:26:16.000000000 +0800
> @@ -556,7 +556,7 @@ static int move_to_new_page(struct page
> * holding a reference to the new page at this point.
> */
> if (!trylock_page(newpage))
> - BUG();
> + return -EAGAIN; /* got by hwpoison */
>
> /* Prepare mapping for the new page.*/
> newpage->index = page->index;

The error handling code in umap_and_move() assumes that the page is
locked upon return from move_to_new_page() even if it failed.

If you return EAGAIN then it may try to unlock a page that is not
locked.

2009-12-03 01:34:31

by Fengguang Wu

[permalink] [raw]
Subject: Re: [PATCH 02/24] migrate: page could be locked by hwpoison, dont BUG()

On Wed, Dec 02, 2009 at 10:50:10PM +0800, Christoph Lameter wrote:
> On Wed, 2 Dec 2009, Wu Fengguang wrote:
>
> > mm/migrate.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > --- linux-mm.orig/mm/migrate.c 2009-11-02 10:18:45.000000000 +0800
> > +++ linux-mm/mm/migrate.c 2009-11-02 10:26:16.000000000 +0800
> > @@ -556,7 +556,7 @@ static int move_to_new_page(struct page
> > * holding a reference to the new page at this point.
> > */
> > if (!trylock_page(newpage))
> > - BUG();
> > + return -EAGAIN; /* got by hwpoison */
> >
> > /* Prepare mapping for the new page.*/
> > newpage->index = page->index;
>
> The error handling code in umap_and_move() assumes that the page is
> locked upon return from move_to_new_page() even if it failed.
>
> If you return EAGAIN then it may try to unlock a page that is not
> locked.

Ah yes, thanks! We could fix it with more changes, however it seems
better to just drop this patch.

Thanks,
Fengguang