diff options
-rw-r--r-- | arch/x86/include/asm/pgtable.h | 5 | ||||
-rw-r--r-- | mm/huge_memory.c | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index c48ba055f693..18601c86fab1 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
@@ -160,6 +160,11 @@ static inline int pmd_trans_huge(pmd_t pmd) | |||
160 | { | 160 | { |
161 | return pmd_val(pmd) & _PAGE_PSE; | 161 | return pmd_val(pmd) & _PAGE_PSE; |
162 | } | 162 | } |
163 | |||
164 | static inline int has_transparent_hugepage(void) | ||
165 | { | ||
166 | return cpu_has_pse; | ||
167 | } | ||
163 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | 168 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ |
164 | 169 | ||
165 | static inline pte_t pte_set_flags(pte_t pte, pteval_t set) | 170 | static inline pte_t pte_set_flags(pte_t pte, pteval_t set) |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index b6facc35e893..915809b16edf 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -487,7 +487,15 @@ static int __init hugepage_init(void) | |||
487 | int err; | 487 | int err; |
488 | #ifdef CONFIG_SYSFS | 488 | #ifdef CONFIG_SYSFS |
489 | static struct kobject *hugepage_kobj; | 489 | static struct kobject *hugepage_kobj; |
490 | #endif | ||
490 | 491 | ||
492 | err = -EINVAL; | ||
493 | if (!has_transparent_hugepage()) { | ||
494 | transparent_hugepage_flags = 0; | ||
495 | goto out; | ||
496 | } | ||
497 | |||
498 | #ifdef CONFIG_SYSFS | ||
491 | err = -ENOMEM; | 499 | err = -ENOMEM; |
492 | hugepage_kobj = kobject_create_and_add("transparent_hugepage", mm_kobj); | 500 | hugepage_kobj = kobject_create_and_add("transparent_hugepage", mm_kobj); |
493 | if (unlikely(!hugepage_kobj)) { | 501 | if (unlikely(!hugepage_kobj)) { |