Commit 0ef89d25d3e390dfa7c46772907951744a4067dc
Committed by
Linus Torvalds
1 parent
c6de002617
Exists in
master
and in
7 other branches
mm/hugetlb: don't crash when HPAGE_SHIFT is 0
Some platform decide whether they support huge pages at boot time. On these, such as powerpc, HPAGE_SHIFT is a variable, not a constant, and is set to 0 when there is no such support. The patches to introduce multiple huge pages support broke that causing the kernel to crash at boot time on machines such as POWER3 which lack support for multiple page sizes. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff
mm/hugetlb.c
... | ... | @@ -1283,7 +1283,12 @@ |
1283 | 1283 | |
1284 | 1284 | static int __init hugetlb_init(void) |
1285 | 1285 | { |
1286 | - BUILD_BUG_ON(HPAGE_SHIFT == 0); | |
1286 | + /* Some platform decide whether they support huge pages at boot | |
1287 | + * time. On these, such as powerpc, HPAGE_SHIFT is set to 0 when | |
1288 | + * there is no such support | |
1289 | + */ | |
1290 | + if (HPAGE_SHIFT == 0) | |
1291 | + return 0; | |
1287 | 1292 | |
1288 | 1293 | if (!size_to_hstate(default_hstate_size)) { |
1289 | 1294 | default_hstate_size = HPAGE_SIZE; |