s390/mm: Fixup hugepage sw-emulated code removal
Subsystems (4)
cover s390/mm: Fixup hugepage sw-emulated code removal
Heiko noticed that the current check for hugepage support on s390 is a little bit to harsh as systems which do not support will crash.
The reason is that pageblock_order can now get negative when we set HPAGE_SHIFT to 0. To avoid all this and to avoid opening another can of worms with enabling HUGETLB_PAGE_SIZE_VARIABLE I think it would be best to simply allow architectures to define their own hugepages_supported().
Thanks
Dominik
Dominik Dingel (4):
Revert "s390/mm: change HPAGE_SHIFT type to int"
Revert "s390/mm: make hugepages_supported a boot time decision"
mm: hugetlb: allow hugepages_supported to be architecture specific s390/hugetlb: add hugepages_supported define
arch/s390/include/asm/hugetlb.h | 1 + arch/s390/include/asm/page.h | 8 ++++---- arch/s390/kernel/setup.c | 2 -- arch/s390/mm/pgtable.c | 2 -- include/linux/hugetlb.h | 17 ++++++++--------- 5 files changed, 13 insertions(+), 17 deletions(-)
Signature · 7 lines
2.3.8 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 1/4 Revert "s390/mm: change HPAGE_SHIFT type to int"
This reverts commit cf54e2fce51c7ad2479fe8cf213a2ed618a8189b.
--- arch/s390/include/asm/page.h | 2 +- arch/s390/mm/pgtable.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/s390/include/asm/page.h +1 -1
@@ -20,7 +20,7 @@#include <asm/setup.h> #ifndef __ASSEMBLY__ -extern int HPAGE_SHIFT ; +extern unsigned int HPAGE_SHIFT ;#define HPAGE_SIZE (1UL << HPAGE_SHIFT)#define HPAGE_MASK (~(HPAGE_SIZE - 1))#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
arch/s390/mm/pgtable.c +1 -1
@@ -31,7 +31,7 @@#define ALLOC_ORDER 2#define FRAG_MASK 0x03 -int HPAGE_SHIFT ; +unsigned int HPAGE_SHIFT ;unsigned long *crst_table_alloc (struct mm_struct *mm) {
Signature · 7 lines
2.3.8 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/4 Revert "s390/mm: make hugepages_supported a boot time decision"
In reply to Dominik DingelThis reverts commit bea41197ead3e03308bdd10c11db3ce91ae5c8ab.
--- arch/s390/include/asm/page.h | 8 ++++---- arch/s390/kernel/setup.c | 2 -- arch/s390/mm/pgtable.c | 2 -- 3 files changed, 4 insertions(+), 8 deletions(-)
arch/s390/include/asm/page.h +4 -4
@@ -17,10 +17,7 @@#define PAGE_DEFAULT_ACC 0#define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4) -#include <asm/setup.h> -#ifndef __ASSEMBLY__ - -extern unsigned int HPAGE_SHIFT ; +#define HPAGE_SHIFT 20#define HPAGE_SIZE (1UL << HPAGE_SHIFT)#define HPAGE_MASK (~(HPAGE_SIZE - 1))#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
@@ -30,6 +27,9 @@ extern unsigned int HPAGE_SHIFT;#define ARCH_HAS_PREPARE_HUGEPAGE #define ARCH_HAS_HUGEPAGE_CLEAR_FLUSH +#include <asm/setup.h> +#ifndef __ASSEMBLY__ +static inline void storage_key_init_range (unsigned long start,unsigned long end) {#if PAGE_DEFAULT_KEY
arch/s390/kernel/setup.c +0 -2
@@ -885,8 +885,6 @@ void __init setup_arch(char **cmdline_p)*/ setup_hwcaps (); -HPAGE_SHIFT =MACHINE_HAS_HPAGE ?20 :0 ; -/* * Create kernel page tables and switch to virtual addressing. */
arch/s390/mm/pgtable.c +0 -2
@@ -31,8 +31,6 @@#define ALLOC_ORDER 2#define FRAG_MASK 0x03 -unsigned int HPAGE_SHIFT ; -unsigned long *crst_table_alloc (struct mm_struct *mm) {struct page *page =alloc_pages (GFP_KERNEL ,ALLOC_ORDER );
Signature · 7 lines
2.3.8 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/4 mm: hugetlb: allow hugepages_supported to be architecture specific
In reply to Dominik Dingels390 has a constant hugepage size, by setting HPAGE_SHIFT we also change e.g. the pageblock_order, which should be independent in respect to hugepage support.
With this patch every architecture is free to define how to check for hugepage support.
--- include/linux/hugetlb.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
include/linux/hugetlb.h +8 -9
@@ -460,15 +460,14 @@ static inline spinlock_t *huge_pte_lockptr(struct hstate *h, return &mm->page_table_lock; } -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 ; -} +#ifndef hugepages_supported +/* +* Some platform decide whether they support huge pages at boot +* time. Some of them, such as powerpc, set HPAGE_SHIFT to 0 +* when there is no such support +*/ +#define hugepages_supported () (HPAGE_SHIFT != 0) +#endif #else /* CONFIG_HUGETLB_PAGE */ struct hstate {};
Signature · 7 lines
2.3.8 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 4/4 s390/hugetlb: add hugepages_supported define
In reply to Dominik DingelOn 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.
--- arch/s390/include/asm/hugetlb.h | 1 + 1 file changed, 1 insertion(+)
arch/s390/include/asm/hugetlb.h +1 -0
@@ -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);
Signature · 7 lines
2.3.8 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 16 lines · On Fri, 3 Jul 2015 14:46:05 +0200 Dominik Dingel <[email protected]>…
Heiko noticed that the current check for hugepage support on s390 is a little bit to harsh as systems which do not support will crash.
The reason is thatpageblock_ordercan now get negative when we setHPAGE_SHIFTto 0. To avoid all this and to avoid opening another can of worms with enablingHUGETLB_PAGE_SIZE_VARIABLEI think it would be best to simply allow architectures to define their ownhugepages_supported().Thanks
DominikDominik Dingel (4):
Revert "s390/mm: changeHPAGE_SHIFTtype to int"
Revert "s390/mm: makehugepages_supporteda boot time decision"
mm: hugetlb: allowhugepages_supportedto be architecture specific s390/hugetlb: addhugepages_supporteddefine
Quoted 6 lines
arch/s390/include/asm/hugetlb.h | 1 + arch/s390/include/asm/page.h | 8 ++++---- arch/s390/kernel/setup.c | 2 -- arch/s390/mm/pgtable.c | 2 -- include/linux/hugetlb.h | 17 ++++++++--------- 5 files changed, 13 insertions(+), 17 deletions(-)
To have an architecture override for hugepages_supported is imho the cleaner approach compared to the HPAGE_SHIFT tricks. I would have preferred to use a __weak function but the #ifndef solution is fine with me as well.
Signature · 10 lines
blue skies, Martin. "Reality continues to ruin my life." - Calvin. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>