Skip to content

Commit 86d0c16

Browse files
chleroytorvalds
authored andcommitted
mm/ioremap: fix iomap_max_page_shift
iomap_max_page_shift is expected to contain a page shift, so it can't be a 'bool', has to be an 'unsigned int' And fix the default values: P4D_SHIFT is when huge iomap is allowed. However, on some architectures (eg: powerpc book3s/64), P4D_SHIFT is not a constant so it can't be used to initialise a static variable. So, initialise iomap_max_page_shift with a maximum shift supported by the architecture, it is gated by P4D_SHIFT in vmap_try_huge_p4d() anyway. Link: https://lkml.kernel.org/r/ad2d366015794a9f21320dcbdd0a8eb98979e9df.1620898113.git.christophe.leroy@csgroup.eu Fixes: bbc180a ("mm: HUGE_VMAP arch support cleanup") Signed-off-by: Christophe Leroy <[email protected]> Reviewed-by: Nicholas Piggin <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent f4d3f25 commit 86d0c16

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mm/ioremap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
#include "pgalloc-track.h"
1717

1818
#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
19-
static bool __ro_after_init iomap_max_page_shift = PAGE_SHIFT;
19+
static unsigned int __ro_after_init iomap_max_page_shift = BITS_PER_LONG - 1;
2020

2121
static int __init set_nohugeiomap(char *str)
2222
{
23-
iomap_max_page_shift = P4D_SHIFT;
23+
iomap_max_page_shift = PAGE_SHIFT;
2424
return 0;
2525
}
2626
early_param("nohugeiomap", set_nohugeiomap);
2727
#else /* CONFIG_HAVE_ARCH_HUGE_VMAP */
28-
static const bool iomap_max_page_shift = PAGE_SHIFT;
28+
static const unsigned int iomap_max_page_shift = PAGE_SHIFT;
2929
#endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
3030

3131
int ioremap_page_range(unsigned long addr,

0 commit comments

Comments
 (0)