diff options
author | James Yang <James.Yang@freescale.com> | 2014-11-14 19:32:24 +0100 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-12-02 04:10:09 +0100 |
commit | c4f3eb5fc527b749d6fb0d47ffdcfe83706dbe2f (patch) | |
tree | c8ff587b47dbfb4ba8546bd80629a1f8bc8c2ec8 | |
parent | powerpc/oprofile: Disable pagefaults during user stack read (diff) | |
download | linux-c4f3eb5fc527b749d6fb0d47ffdcfe83706dbe2f.tar.xz linux-c4f3eb5fc527b749d6fb0d47ffdcfe83706dbe2f.zip |
powerpc/mm/hugetlb: Sanity check gigantic hugepage count
Limit the number of gigantic hugepages specified by the
hugepages= parameter to MAX_NUMBER_GPAGES.
Signed-off-by: James Yang <James.Yang@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/mm/hugetlbpage.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index af56de82375d..747e0c616526 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -355,6 +355,13 @@ static int __init do_gpage_early_setup(char *param, char *val, if (size != 0) { if (sscanf(val, "%lu", &npages) <= 0) npages = 0; + if (npages > MAX_NUMBER_GPAGES) { + pr_warn("MMU: %lu pages requested for page " + "size %llu KB, limiting to " + __stringify(MAX_NUMBER_GPAGES) "\n", + npages, size / 1024); + npages = MAX_NUMBER_GPAGES; + } gpage_npages[shift_to_mmu_psize(__ffs(size))] = npages; size = 0; } |