[PATCH 2/3] s390/hugetlb: add hugepages_supported define

Luis Henriques luis.henriques at canonical.com
Thu Sep 22 12:40:14 UTC 2016


From: Dominik Dingel <dingel at linux.vnet.ibm.com>

On s390 we only can enable hugepages if the underlying hardware/hypervisor
also does support this.  Common code now would assume this to be
signaled by setting HPAGE_SHIFT to 0.  But on s390, where we only
support one hugepage size, there is a link between HPAGE_SHIFT and
pageblock_order.

So instead of setting HPAGE_SHIFT to 0, we will implement the check for
the hardware capability.

Signed-off-by: Dominik Dingel <dingel at linux.vnet.ibm.com>
Acked-by: Martin Schwidefsky <schwidefsky at de.ibm.com>
Cc: Heiko Carstens <heiko.carstens at de.ibm.com>
Cc: Christian Borntraeger <borntraeger at de.ibm.com>
Cc: Michael Holzheu <holzheu at linux.vnet.ibm.com>
Cc: Gerald Schaefer <gerald.schaefer at de.ibm.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
CVE-2016-3961
BugLink: https://bugs.launchpad.net/bugs/1571020
(cherry picked from commit 7f9be77555bb2e52de84e9dddf7b4eb20cc6e171)
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 arch/s390/include/asm/hugetlb.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h
index 11eae5f55b70..9787b61e0758 100644
--- a/arch/s390/include/asm/hugetlb.h
+++ b/arch/s390/include/asm/hugetlb.h
@@ -14,6 +14,7 @@
 
 #define is_hugepage_only_range(mm, addr, len)	0
 #define hugetlb_free_pgd_range			free_pgd_range
+#define hugepages_supported()			(MACHINE_HAS_HPAGE)
 
 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
 		     pte_t *ptep, pte_t pte);




More information about the kernel-team mailing list