linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm,numa,THP: initialize hstate for THP page size
@ 2013-12-18 22:03 Rik van Riel
  2013-12-18 22:08 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Rik van Riel @ 2013-12-18 22:03 UTC (permalink / raw)
  To: linux-kernel
  Cc: Chao Yang, linux-mm, akpm, aarcange, mgorman, Veaceslav Falico,
	Naoya Horiguchi, David Rientjes, Michel Lespinasse, Michal Hocko

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@redhat.com>
Reported-by: Chao Yang <chayang@redhat.com>
---
 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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-12-19 16:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-18 22:03 [PATCH] mm,numa,THP: initialize hstate for THP page size Rik van Riel
2013-12-18 22:08 ` Andrew Morton
2013-12-18 22:20   ` Rik van Riel
2013-12-19 10:22     ` Michal Hocko
2013-12-19 15:18       ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).