Re: Race in new page migration code?

Nick Piggin
2006-01-17T11:16:10Z

On Mon, Jan 16, 2006 at 09:06:29PM -0800, Christoph Lameter wrote:
> 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?
>

Yes something like that would be good.
There are other users of PageReserved, drivers, memory holes,
kernel text, bootmem allocated memory (I think), 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);