From: Anshuman Khandual <anshuman.khandual@arm.com>
To: linux-mm@kvack.org
Cc: Anshuman Khandual <anshuman.khandual@arm.com>,
Muchun Song <muchun.song@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Oscar Salvador <osalvador@suse.de>,
linux-kernel@vger.kernel.org
Subject: [PATCH V2] mm/hugetlb: Make __NR_USED_SUBPAGE check conditional
Date: Tue, 3 Dec 2024 08:02:07 +0530 [thread overview]
Message-ID: <20241203023207.123416-1-anshuman.khandual@arm.com> (raw)
The HugeTLB order check against __NR_USED_SUBPAGE is required only when
HUGETLB_PAGE_OPTIMIZE_VMEMMAP is enabled. Hence BUG_ON() trigger should
happen only when applicable.
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
This patch applies on v6.13-rc1
Changes in V2:
- Fixed #ifdef with CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP per Oscar
Changes in V1:
https://lore.kernel.org/all/20241202090728.78935-1-anshuman.khandual@arm.com/
mm/hugetlb.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index ea2ed8e301ef..e6a5b21e3578 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4513,11 +4513,13 @@ void __init hugetlb_add_hstate(unsigned int order)
struct hstate *h;
unsigned long i;
- if (size_to_hstate(PAGE_SIZE << order)) {
+ if (size_to_hstate(PAGE_SIZE << order))
return;
- }
+
BUG_ON(hugetlb_max_hstate >= HUGE_MAX_HSTATE);
+#ifdef CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
BUG_ON(order < order_base_2(__NR_USED_SUBPAGE));
+#endif
h = &hstates[hugetlb_max_hstate++];
__mutex_init(&h->resize_lock, "resize mutex", &h->resize_key);
h->order = order;
--
2.30.2
next reply other threads:[~2024-12-03 2:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-03 2:32 Anshuman Khandual [this message]
2024-12-03 3:29 ` Muchun Song
2024-12-03 7:46 ` Anshuman Khandual
2024-12-03 8:20 ` Muchun Song
2024-12-04 2:46 ` Anshuman Khandual
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241203023207.123416-1-anshuman.khandual@arm.com \
--to=anshuman.khandual@arm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=osalvador@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox