Re: [PATCH 10/19] mm, mpol: Use special PROT_NONE to migrate pages

From: Andrea Arcangeli
Date: Thu Aug 09 2012 - 17:44:37 EST


On Tue, Jul 31, 2012 at 09:12:14PM +0200, Peter Zijlstra wrote:
> +#ifdef CONFIG_NUMA
> /*
> - * Do fancy stuff...
> + * For NUMA systems we use the special PROT_NONE maps to drive
> + * lazy page migration, see MPOL_MF_LAZY and related.
> */
> + page = vm_normal_page(vma, address, entry);
> + if (!page)
> + goto do_fixup_locked;
> +
> + get_page(page);
> + pte_unmap_unlock(ptep, ptl);
> +
> + node = mpol_misplaced(page, vma, address);
> + if (node == -1)
> + goto do_fixup;
>
> /*
> + * Page migration will install a new pte with vma->vm_page_prot,
> + * otherwise fall-through to the fixup. Next time,.. perhaps.
> + */
> + if (!migrate_misplaced_page(mm, page, node)) {
> + put_page(page);
> + return 0;
> + }
> +
> +do_fixup:
> + /*
> * OK, nothing to do,.. change the protection back to what it
> * ought to be.
> */
> @@ -3467,6 +3493,9 @@ static int do_prot_none(struct mm_struct
> if (unlikely(!pte_same(*ptep, entry)))
> goto unlock;
>
> +do_fixup_locked:
> +#endif /* CONFIG_NUMA */
> +

Do fancy stuff would better of be in a separate file instead of mixing
it with the numa hinting page fault entry points in memory.c. My
"fancy stuff" happens in mm/autonuma.c. memory.c calls it.

> flush_cache_page(vma, address, pte_pfn(entry));
>
> ptep_modify_prot_start(mm, address, ptep);
> @@ -3476,8 +3505,9 @@ static int do_prot_none(struct mm_struct
> update_mmu_cache(vma, address, ptep);
> unlock:
> pte_unmap_unlock(ptep, ptl);
> -out:
> - return ret;
> + if (page)
> + put_page(page);
> + return 0;
> }
>
> /*
>
>
> --
> 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/
--
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/