linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dev Jain <dev.jain@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>, akpm@linux-foundation.org
Cc: rppt@kernel.org, ryan.roberts@arm.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: Remove PMD alignment constraint in execmem_vmalloc()
Date: Mon, 22 Sep 2025 12:20:24 +0530	[thread overview]
Message-ID: <c468ffc7-bf4f-4b0e-b02f-f926f1c2a836@arm.com> (raw)
In-Reply-To: <2a7e000c-f075-487e-a750-1fa8d29adfe8@arm.com>


On 22/09/25 11:32 am, Anshuman Khandual wrote:
>
> On 18/09/25 3:04 PM, Dev Jain wrote:
>> When using vmalloc with VM_ALLOW_HUGE_VMAP flag, it will set the alignment
>> to PMD_SIZE internally, if it deems huge mappings to be eligible.
>> Therefore, setting the alignment in execmem_vmalloc is redundant. Apart
>> from this, it also reduces the probability of allocation in case vmalloc
>> fails to allocate hugepages - in the fallback case, vmalloc tries to use
>> the original alignment and allocate basepages, which unfortunately will
>> again be PMD_SIZE passed over from execmem_vmalloc, thus constraining
>> the search for a free space in vmalloc region.
>>
>> Therefore, remove this constraint.
>>
>> Signed-off-by: Dev Jain <dev.jain@arm.com>
>> ---
>> mm-selftests pass, but I am not sure if they touch execmem code, and I
>> have no experience with this code.
>>
>>   mm/execmem.c | 3 ---
>>   1 file changed, 3 deletions(-)
>>
>> diff --git a/mm/execmem.c b/mm/execmem.c
>> index 0822305413ec..810a4ba9c924 100644
>> --- a/mm/execmem.c
>> +++ b/mm/execmem.c
>> @@ -38,9 +38,6 @@ static void *execmem_vmalloc(struct execmem_range *range, size_t size,
>>   	if (kasan)
>>   		vm_flags |= VM_DEFER_KMEMLEAK;
>>   
>> -	if (vm_flags & VM_ALLOW_HUGE_VMAP)
>> -		align = PMD_SIZE;
>> -
> So if the above assignment is getting dropped here, probably the local
> variable 'align' could be dropped as well and range->alignment be used
> directly instead ?

Sure, but that isn't a big deal. Replacing with range->aligment will
push the arguments declaration into an extra line in __vmalloc_node_range.
So will prefer not respinning for this triviality, this has already
been pulled into mm-new :)

>>   	p = __vmalloc_node_range(size, align, start, end, gfp_flags,
>>   				 pgprot, vm_flags, NUMA_NO_NODE,
>>   				 __builtin_return_address(0));


      reply	other threads:[~2025-09-22  6:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-18  9:34 Dev Jain
2025-09-18 10:33 ` Mike Rapoport
2025-09-18 13:06   ` Ryan Roberts
2025-09-21  7:39     ` Mike Rapoport
2025-09-22  6:02 ` Anshuman Khandual
2025-09-22  6:50   ` Dev Jain [this message]

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=c468ffc7-bf4f-4b0e-b02f-f926f1c2a836@arm.com \
    --to=dev.jain@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.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