hugetlb: ensure hugepage access is denied if hugepages are not supported
[pandora-kernel.git] / include / linux / hugetlb.h
index 4bc9445..c5e40ff 100644 (file)
@@ -344,6 +344,16 @@ static inline pgoff_t basepage_index(struct page *page)
        return __basepage_index(page);
 }
 
+static inline bool hugepages_supported(void)
+{
+       /*
+        * Some platform decide whether they support huge pages at boot
+        * time. On these, such as powerpc, HPAGE_SHIFT is set to 0 when
+        * there is no such support
+        */
+       return HPAGE_SHIFT != 0;
+}
+
 #else
 struct hstate {};
 #define alloc_huge_page_node(h, nid) NULL