[PATCH 2/7] check hugepage swap entry in get_user_pages_fast()

From: Naoya Horiguchi
Date: Fri Jan 21 2011 - 01:33:34 EST


When the hugepage associated with a given address is HWPOISONed
or under page migration, get_user_pages_fast() need to fall back
to slow path in order to make the page fault fail (when HWPOISONed)
or to wait for migration completion (when under migration.)

Signed-off-by: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx>
---
arch/x86/mm/gup.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)

diff --git v2.6.38-rc1/arch/x86/mm/gup.c v2.6.38-rc1/arch/x86/mm/gup.c
index dbe34b9..93b74dd 100644
--- v2.6.38-rc1/arch/x86/mm/gup.c
+++ v2.6.38-rc1/arch/x86/mm/gup.c
@@ -176,6 +176,15 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
*/
if (pmd_none(pmd) || pmd_trans_splitting(pmd))
return 0;
+ /*
+ * PMD can be in swap entry style when the hugepage
+ * pointed to by it is hwpoisoned or under migration.
+ * Because the swap entry format has no flag showing
+ * the page size, pmd_large() cannot detect it.
+ * So then we just fall back to the slow path.
+ */
+ if (unlikely(!pmd_present(pmd)))
+ return 0;
if (unlikely(pmd_large(pmd))) {
if (!gup_huge_pmd(pmd, addr, next, write, pages, nr))
return 0;
--
1.7.3.4

--
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/