diff mbox series

[v3,bpf,RESEND,2/4] page_alloc: use __vmalloc_huge for large system hash

Message ID 20220414195914.1648345-3-song@kernel.org (mailing list archive)
State New
Headers show
Series vmalloc: bpf: introduce VM_ALLOW_HUGE_VMAP | expand

Commit Message

Song Liu April 14, 2022, 7:59 p.m. UTC
Use __vmalloc_huge() in alloc_large_system_hash() so that large system
hash (>= PMD_SIZE) could benefit from huge pages. Note that __vmalloc_huge
only allocates huge pages for systems with HAVE_ARCH_HUGE_VMALLOC.

Signed-off-by: Song Liu <song@kernel.org>
---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig April 15, 2022, 6:32 a.m. UTC | #1
On Thu, Apr 14, 2022 at 12:59:12PM -0700, Song Liu wrote:
> Use __vmalloc_huge() in alloc_large_system_hash() so that large system
> hash (>= PMD_SIZE) could benefit from huge pages. Note that __vmalloc_huge
> only allocates huge pages for systems with HAVE_ARCH_HUGE_VMALLOC.

Looks good (modulo the possible naming chane suggested in patch 1):

Reviewed-by: Christoph Hellwig <hch@lst.de>
Song Liu April 15, 2022, 4:57 p.m. UTC | #2
Hi Christoph, 

> On Apr 14, 2022, at 11:32 PM, Christoph Hellwig <hch@infradead.org> wrote:
> 
> On Thu, Apr 14, 2022 at 12:59:12PM -0700, Song Liu wrote:
>> Use __vmalloc_huge() in alloc_large_system_hash() so that large system
>> hash (>= PMD_SIZE) could benefit from huge pages. Note that __vmalloc_huge
>> only allocates huge pages for systems with HAVE_ARCH_HUGE_VMALLOC.
> 
> Looks good (modulo the possible naming chane suggested in patch 1):
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Thanks for your kind review!

Could you please share your thoughts on shipping the set with 5.18 (or 
whether we should postpone it)? 

AFAICT, the only changed behavior is to allow alloc_large_system_hash
return huge pages for size > PMD_SIZE on x86_64. I think this is 
relatively safe, as this is only for large hash and we are at rc2. 

Thanks,
Song
diff mbox series

Patch

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6e5b4488a0c5..20d38b8482c4 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8919,7 +8919,7 @@  void *__init alloc_large_system_hash(const char *tablename,
 				table = memblock_alloc_raw(size,
 							   SMP_CACHE_BYTES);
 		} else if (get_order(size) >= MAX_ORDER || hashdist) {
-			table = __vmalloc(size, gfp_flags);
+			table = __vmalloc_huge(size, gfp_flags);
 			virt = true;
 			if (table)
 				huge = is_vm_area_hugepages(table);