[PATCH] mm,numa,THP: initialize hstate for THP page size
From: Rik van Riel
Date: Wed Dec 18 2013 - 17:03:33 EST
When hugetlbfs is started with a non-default page size, it is
possible that no hstate is initialized for the page sized used
by transparent huge pages.
This causes copy_huge_page to crash on a null pointer. Make
sure we always have an hpage initialized for the page sized
used by THP.
Signed-off-by: Rik van Riel <riel@xxxxxxxxxx>
Reported-by: Chao Yang <chayang@xxxxxxxxxx>
---
mm/huge_memory.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 5749bcf..583e9d3 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -624,6 +624,13 @@ static int __init hugepage_init(void)
return -EINVAL;
}
+ /*
+ * Make sure an hstate is initialized for our page size,
+ * even if hugetlbfs is using a non-default page size.
+ */
+ if (!size_to_hstate(PMD_PAGE_SIZE))
+ hugetlb_add_hstate(HUGETLB_PAGE_ORDER);
+
err = hugepage_init_sysfs(&hugepage_kobj);
if (err)
return err;
--
All Rights Reversed
--
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/