Re: Race in new page migration code?

Christoph Lameter
2006-01-17T05:06:29Z

On Mon, 16 Jan 2006, Nick Piggin wrote:

> On Mon, Jan 16, 2006 at 05:51:26PM +0100, Andi Kleen wrote:
> >
> > I agree with Christoph that the zero page should be ignored - old behaviour
> > was really a bug.
> >
>
> Fair enough. It would be nice to have a comment there has Hugh said;
> it is not always clear what PageReserved is intended to test for.

Something like this? Are there still other uses of PageReserved than the
zero page?

Explain the use of PageReserved in check_pte_range.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.15/mm/mempolicy.c
===================================================================
--- linux-2.6.15.orig/mm/mempolicy.c 2006-01-14 10:56:31.000000000 -0800
+++ linux-2.6.15/mm/mempolicy.c 2006-01-16 21:03:03.000000000 -0800
@@ -211,6 +211,17 @@ static int check_pte_range(struct vm_are
page = vm_normal_page(vma, addr, *pte);
if (!page)
continue;
+ /*
+ * The check for PageReserved here is important to avoid
+ * handling zero pages and other pages that may have been
+ * marked special by the system.
+ *
+ * If the PageReserved would not be checked here then f.e.
+ * the location of the zero page could have an influence
+ * on MPOL_MF_STRICT, zero pages would be counted for
+ * the per node stats, and there would be useless attempts
+ * to put zero pages on the migration list.
+ */
if (PageReserved(page))
continue;
nid = page_to_nid(page);