From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
To: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>
Cc: Vishal Moola <vishal.moola@gmail.com>,
Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
Baoquan He <bhe@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
Uladzislau Rezki <urezki@gmail.com>
Subject: [PATCH 1/2] mm/vmalloc: Add large-order allocation helper
Date: Tue, 16 Dec 2025 22:19:20 +0100 [thread overview]
Message-ID: <20251216211921.1401147-1-urezki@gmail.com> (raw)
Refactor vm_area_alloc_pages() by moving the high-order allocation
code into a separate function, vm_area_alloc_pages_large_order().
No functional changes.
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
---
mm/vmalloc.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index ecbac900c35f..d3a4725e15ca 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -3624,18 +3624,20 @@ static inline gfp_t vmalloc_gfp_adjust(gfp_t flags, const bool large)
return flags;
}
-static inline unsigned int
-vm_area_alloc_pages(gfp_t gfp, int nid,
- unsigned int order, unsigned int nr_pages, struct page **pages)
+static unsigned int
+vm_area_alloc_pages_large_order(gfp_t gfp, int nid, unsigned int order,
+ unsigned int nr_pages, struct page **pages)
{
unsigned int nr_allocated = 0;
unsigned int nr_remaining = nr_pages;
unsigned int max_attempt_order = MAX_PAGE_ORDER;
struct page *page;
+ unsigned int large_order;
+ gfp_t large_gfp;
int i;
- unsigned int large_order = ilog2(nr_remaining);
- gfp_t large_gfp = vmalloc_gfp_adjust(gfp, large_order) & ~__GFP_DIRECT_RECLAIM;
+ large_order = ilog2(nr_remaining);
+ large_gfp = vmalloc_gfp_adjust(gfp, large_order) & ~__GFP_DIRECT_RECLAIM;
large_order = min(max_attempt_order, large_order);
/*
@@ -3666,6 +3668,20 @@ vm_area_alloc_pages(gfp_t gfp, int nid,
large_order = min(max_attempt_order, large_order);
}
+ return nr_allocated;
+}
+
+static inline unsigned int
+vm_area_alloc_pages(gfp_t gfp, int nid,
+ unsigned int order, unsigned int nr_pages, struct page **pages)
+{
+ unsigned int nr_allocated = 0;
+ struct page *page;
+ int i;
+
+ nr_allocated = vm_area_alloc_pages_large_order(gfp, nid,
+ order, nr_pages, pages);
+
/*
* For order-0 pages we make use of bulk allocator, if
* the page array is partly or not at all populated due
--
2.47.3
next reply other threads:[~2025-12-16 21:19 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-16 21:19 Uladzislau Rezki (Sony) [this message]
2025-12-16 21:19 ` [PATCH 2/2] mm/vmalloc: Add attempt_larger_order_alloc parameter Uladzislau Rezki (Sony)
2025-12-16 23:36 ` Andrew Morton
2025-12-17 11:37 ` Uladzislau Rezki
2025-12-17 3:54 ` Baoquan He
2025-12-17 11:44 ` Uladzislau Rezki
2025-12-17 11:49 ` Dev Jain
2025-12-17 11:53 ` Uladzislau Rezki
2025-12-18 10:34 ` Baoquan He
2025-12-17 8:27 ` Ryan Roberts
2025-12-17 12:02 ` Uladzislau Rezki
2025-12-17 15:20 ` Ryan Roberts
2025-12-17 17:01 ` Ryan Roberts
2025-12-17 19:22 ` Uladzislau Rezki
2025-12-18 11:12 ` Ryan Roberts
2025-12-18 11:33 ` Uladzislau Rezki
2025-12-17 20:08 ` Uladzislau Rezki
2025-12-18 11:14 ` Ryan Roberts
2025-12-18 11:29 ` Uladzislau Rezki
2025-12-18 4:55 ` Dev Jain
2025-12-18 11:53 ` Ryan Roberts
2025-12-18 11:56 ` Ryan Roberts
2025-12-19 8:33 ` David Hildenbrand (Red Hat)
2025-12-19 11:17 ` Ryan Roberts
2025-12-19 0:34 ` Vishal Moola (Oracle)
2025-12-19 11:23 ` Ryan Roberts
2025-12-24 6:35 ` Dev Jain
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=20251216211921.1401147-1-urezki@gmail.com \
--to=urezki@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=dev.jain@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryan.roberts@arm.com \
--cc=vishal.moola@gmail.com \
/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