erenced by the Depends-on tag is present. When backporting this patch, the commit mentioned in the Depends-on tag must be included first. Link: https://lore.kernel.org/all/20250121150419.1342794-1-sourabhjain@linux.ibm.com/ [1] Link: https://lore.kernel.org/all/20250128043358.163372-1-sourabhjain@linux.ibm.com/ [2] Fixes: c2833a5bf75b ("hugetlbfs: fix changes to command line processing") Depends-on: 2354ad252b66 ("powerpc/mm: Update default hugetlb size early") Cc: Andrew Morton Cc: Borislav Petkov Cc: Christophe Leroy Cc: Heiko Carstens Cc: Ingo Molnar Cc: Madhavan Srinivasan Cc: Michael Ellerman Cc: Muchun Song Cc: Oscar Salvador Cc: Thomas Gleixner Cc: Vasily Gorbik Cc: linux-mm@kvack.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-s390@vger.kernel.org Cc: x86@kernel.org Cc: linux-riscv@lists.infradead.org Acked-by: David Hildenbrand (Red Hat) Reviewed-by: Ritesh Harjani (IBM) Signed-off-by: Sourabh Jain --- Changelog: v1: https://lore.kernel.org/all/20250121150419.1342794-1-sourabhjain@linux.ibm.com/ v2: https://lore.kernel.org/all/20250124103220.111303-1-sourabhjain@linux.ibm.com/ - disable gigantic hugepage in arch code, arch_hugetlb_valid_size() v3: https://lore.kernel.org/all/20250125104928.88881-1-sourabhjain@linux.ibm.com/ - Do not modify the initialization of the shift variable v4: https://lore.kernel.org/all/20250128043358.163372-1-sourabhjain@linux.ibm.com/ - Update commit message to include how hugepages_supported() detects hugepages support when fadump is active - Add Reviewed-by tag - NO functional change v5: https://lore.kernel.org/all/20251218114154.228484-1-sourabhjain@linux.ibm.com/ - Significant change in approach: disable processing of hugepage kernel arguments if hugepages_supported() returns false - Drop a Reviewed-by tag v6: https://lore.kernel.org/all/20251221053611.441251-1-sourabhjain@linux.ibm.com/ - Updated commit message with additional logs and tags - No functional changes v7: - Add a note for backporting this fix in the commit message - Add a Depends-on tag referencing the prerequisite commit - No functional changes --- mm/hugetlb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 51273baec9e5..e0ab14020513 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4286,6 +4286,11 @@ static int __init hugepages_setup(char *s) unsigned long tmp; char *p = s; + if (!hugepages_supported()) { + pr_warn("HugeTLB: hugepages unsupported, ignoring hugepages=%s cmdline\n", s); + return 0; + } + if (!parsed_valid_hugepagesz) { pr_warn("HugeTLB: hugepages=%s does not follow a valid hugepagesz, ignoring\n", s); parsed_valid_hugepagesz = true; @@ -4366,6 +4371,11 @@ static int __init hugepagesz_setup(char *s) unsigned long size; struct hstate *h; + if (!hugepages_supported()) { + pr_warn("HugeTLB: hugepages unsupported, ignoring hugepagesz=%s cmdline\n", s); + return 0; + } + parsed_valid_hugepagesz = false; size = (unsigned long)memparse(s, NULL); @@ -4414,6 +4424,12 @@ static int __init default_hugepagesz_setup(char *s) unsigned long size; int i; + if (!hugepages_supported()) { + pr_warn("HugeTLB: hugepages unsupported, ignoring default_hugepagesz=%s cmdline\n", + s); + return 0; + } + parsed_valid_hugepagesz = false; if (parsed_default_hugepagesz) { pr_err("HugeTLB: default_hugepagesz previously specified, ignoring %s\n", s); -- 2.51.1[PATCH v7] mm/hugetlb: ignore hugepage kernel args if hugepages are unsupportedSourabh Jain undefinedlinux-kernel@vger.kernel.org undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined