linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/hugetlb: Make __NR_USED_SUBPAGE check conditional
@ 2024-12-02  9:07 Anshuman Khandual
  2024-12-02 10:37 ` Oscar Salvador
  0 siblings, 1 reply; 2+ messages in thread
From: Anshuman Khandual @ 2024-12-02  9:07 UTC (permalink / raw)
  To: linux-mm; +Cc: Anshuman Khandual, Muchun Song, Andrew Morton, linux-kernel

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: 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

 mm/hugetlb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index ea2ed8e301ef..b7443c7f3e0c 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 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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/hugetlb: Make __NR_USED_SUBPAGE check conditional
  2024-12-02  9:07 [PATCH] mm/hugetlb: Make __NR_USED_SUBPAGE check conditional Anshuman Khandual
@ 2024-12-02 10:37 ` Oscar Salvador
  0 siblings, 0 replies; 2+ messages in thread
From: Oscar Salvador @ 2024-12-02 10:37 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: linux-mm, Muchun Song, Andrew Morton, linux-kernel

On Mon, Dec 02, 2024 at 02:37:28PM +0530, Anshuman Khandual wrote:
> 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: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
...
> +
>  	BUG_ON(hugetlb_max_hstate >= HUGE_MAX_HSTATE);
> +#ifdef HUGETLB_PAGE_OPTIMIZE_VMEMMAP

 #ifdef CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP ?
 

-- 
Oscar Salvador
SUSE Labs


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-02 10:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-02  9:07 [PATCH] mm/hugetlb: Make __NR_USED_SUBPAGE check conditional Anshuman Khandual
2024-12-02 10:37 ` Oscar Salvador

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox