Skip to contentSkip to conversation

mm/hugetlb: use hugetlb_vmemmap_optimizable() in boolean contexts

PATCH Applied Kaitao Cheng 3 participants 3 messages Aug 24 – Aug 25

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/hugetlb: use hugetlb_vmemmap_optimizable() in boolean contexts

From: Kaitao Cheng <[email protected]>

The two boot-time sites in hugetlb_hstate_alloc_pages_onenode() and hugetlb_pages_alloc_boot_node() only need to know whether HVO is applicable, not the exact optimizable size. Switch them from hugetlb_vmemmap_optimizable_size() to hugetlb_vmemmap_optimizable() to make intent explicit.

No functional change intended.

---
 mm/hugetlb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/hugetlb.c +2 -2
index a03a75fd7fa8..885f721999e6 100644
@@ -3416,7 +3416,7 @@ static void __init hugetlb_hstate_alloc_pages_onenode(struct hstate *h, int nid)
 			folio = only_alloc_fresh_hugetlb_folio(h, gfp_mask, nid,
 					&node_states[N_MEMORY], NULL);
 			if (!folio && !list_empty(&folio_list) &&
-			    hugetlb_vmemmap_optimizable_size(h)) {
+			    hugetlb_vmemmap_optimizable(h)) {
 				prep_and_add_allocated_folios(h, &folio_list);
 				INIT_LIST_HEAD(&folio_list);
 				folio = only_alloc_fresh_hugetlb_folio(h, gfp_mask, nid,
@@ -3485,7 +3485,7 @@ static void __init hugetlb_pages_alloc_boot_node(unsigned long start, unsigned l
 	for (i = 0; i < num; ++i) {
 		struct folio *folio;
 
-		if (hugetlb_vmemmap_optimizable_size(h) &&
+		if (hugetlb_vmemmap_optimizable(h) &&
 		    (si_mem_available() == 0) && !list_empty(&folio_list)) {
 			prep_and_add_allocated_folios(h, &folio_list);
 			INIT_LIST_HEAD(&folio_list);
Signature · 1 line
2.50.1 (Apple Git-155)
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Mon, 24 Aug 2026 23:16:55 +0800 Kaitao Cheng <[email protected]> wrote:

From: Kaitao Cheng <[email protected]>

The two boot-time sites in hugetlb_hstate_alloc_pages_onenode() and hugetlb_pages_alloc_boot_node() only need to know whether HVO is applicable, not the exact optimizable size. Switch them from hugetlb_vmemmap_optimizable_size() to hugetlb_vmemmap_optimizable() to make intent explicit.

Hi Kaitao, thank you for the patch.

I think the changes look good. hugetlb_vmemmap_optimizable is just a oneliner that checks hugetlb_vmemmap_optimizable_size != 0 anyways so this change seems clean with no side effects.

Notably this leaves the only user of hugetlb_vmemmap_optimizable_size an inittimepr_info statement. Just thought I would note that here.

Have a great day!

Quoted 33 lines

No functional change intended.

---
 mm/hugetlb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/hugetlb.c +2 -2
index a03a75fd7fa8..885f721999e6 100644
@@ -3416,7 +3416,7 @@ static void __init hugetlb_hstate_alloc_pages_onenode(struct hstate *h, int nid)
 			folio = only_alloc_fresh_hugetlb_folio(h, gfp_mask, nid,
 					&node_states[N_MEMORY], NULL);
 			if (!folio && !list_empty(&folio_list) &&
-			    hugetlb_vmemmap_optimizable_size(h)) {
+			    hugetlb_vmemmap_optimizable(h)) {
 				prep_and_add_allocated_folios(h, &folio_list);
 				INIT_LIST_HEAD(&folio_list);
 				folio = only_alloc_fresh_hugetlb_folio(h, gfp_mask, nid,
@@ -3485,7 +3485,7 @@ static void __init hugetlb_pages_alloc_boot_node(unsigned long start, unsigned l
 	for (i = 0; i < num; ++i) {
 		struct folio *folio;
 
-		if (hugetlb_vmemmap_optimizable_size(h) &&
+		if (hugetlb_vmemmap_optimizable(h) &&
 		    (si_mem_available() == 0) && !list_empty(&folio_list)) {
 			prep_and_add_allocated_folios(h, &folio_list);
 			INIT_LIST_HEAD(&folio_list);
Signature · 1 line
2.50.1 (Apple Git-155)
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Kaitao Cheng
Quoted 12 lines · Kaitao Cheng

From: Kaitao Cheng <[email protected]>

The two boot-time sites in hugetlb_hstate_alloc_pages_onenode() and hugetlb_pages_alloc_boot_node() only need to know whether HVO is applicable, not the exact optimizable size. Switch them from hugetlb_vmemmap_optimizable_size() to hugetlb_vmemmap_optimizable() to make intent explicit.

Quoted 3 lines

No functional change intended.

Thanks.