diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-07-31 00:07:30 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-01 12:46:41 -0700 |
commit | 0ef89d25d3e390dfa7c46772907951744a4067dc (patch) | |
tree | 768d97175d6df35408733f6fe40cf414b4ac75bd /mm/hugetlb.c | |
parent | c6de002617c199f80f9a2a713dffc263bdc69b81 (diff) | |
download | kernel_samsung_smdk4412-0ef89d25d3e390dfa7c46772907951744a4067dc.tar.gz kernel_samsung_smdk4412-0ef89d25d3e390dfa7c46772907951744a4067dc.tar.bz2 kernel_samsung_smdk4412-0ef89d25d3e390dfa7c46772907951744a4067dc.zip |
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>
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r-- | mm/hugetlb.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index d237a02eb22..28a2980ee43 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1283,7 +1283,12 @@ module_exit(hugetlb_exit); static int __init hugetlb_init(void) { - BUILD_BUG_ON(HPAGE_SHIFT == 0); + /* 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 + */ + if (HPAGE_SHIFT == 0) + return 0; if (!size_to_hstate(default_hstate_size)) { default_hstate_size = HPAGE_SIZE; |