From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB4AE20C00C for ; Mon, 20 Jul 2026 07:50:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784533857; cv=none; b=BMpwBqo8kWnCZLhniw6TyBF8C4xce6i66UN8w255dfQ4+IpqebbEe284yuE+TJePQdTXArNSVqbyogyNAn4SLats5B5JR3aD3sijBQGGXGe8snZ0nfKQ2ogk7NiO4yqRcTLsfMtoanzLVfhtrvP8RRvIG9EUqDpiwjXHArTSYxY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784533857; c=relaxed/simple; bh=2Un4GO8yOvt4jQTKL0yMvo/Ed/dJKpSRadpiypHDvPg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=sSbdhACixtJmVnCs3/r72KS7XU50v/TaktxbBzduUmmpl8QEPw28qCP3WIa6wfrUgNmaI7itvtG1qazesOlIk19Ijnobcg+ITD8RIp2BPNCmG/FlIevKb3rud1STvR8EoxfxbYcVAy14CJ4T8MMTnbc34T8GcEkuohZKLZhaLQo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=N3Y1fIEH; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="N3Y1fIEH" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 299F22B; Mon, 20 Jul 2026 00:50:51 -0700 (PDT) Received: from [10.164.19.57] (unknown [10.164.19.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 10F823F86F; Mon, 20 Jul 2026 00:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1784533855; bh=2Un4GO8yOvt4jQTKL0yMvo/Ed/dJKpSRadpiypHDvPg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=N3Y1fIEH02S7auRV/kad7+v07C+/uk7U1HwOWDfGg9cVKuJxjpF4lLb4rTj8QcSVM fy1FCBwPyvvEce0+BXG4UcjaKJJF9wjlLKZNU3G1qgpI12D+s8sxjqCjt5PHMGl/1o HVQy4QlxnijXCCw0L/cqoKcHdjO0pr1e+G9OvkWc= Message-ID: <243328f9-1247-4104-ad09-b2f6de520128@arm.com> Date: Mon, 20 Jul 2026 13:20:48 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 5/7] mm/vmalloc: Extract vm_shift() to consolidate mapping shift selection To: Wen Jiang , akpm@linux-foundation.org, catalin.marinas@arm.com, linux-mm@kvack.org, urezki@gmail.com, will@kernel.org Cc: Xueyuan.chen21@gmail.com, ajd@linux.ibm.com, anshuman.khandual@arm.com, david@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, rppt@kernel.org, ryan.roberts@arm.com, baohua@kernel.org, Wen Jiang , Leo Yan References: <20260715120813.3609949-1-jiangwen6@xiaomi.com> <20260715120813.3609949-6-jiangwen6@xiaomi.com> Content-Language: en-US From: Dev Jain In-Reply-To: <20260715120813.3609949-6-jiangwen6@xiaomi.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 15/07/26 5:38 pm, Wen Jiang wrote: > Extract the vmalloc mapping shift selection from > __vmalloc_node_range_noprof() into vm_shift(), preparing for reuse by the > vmap batching path. > > No functional change. > > Suggested-by: Dev Jain > Signed-off-by: Wen Jiang > Tested-by: Xueyuan Chen > Tested-by: Leo Yan > --- Reviewed-by: Dev Jain > mm/vmalloc.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index afc695d5973e8..a1e025120e9df 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -3549,6 +3549,14 @@ void vunmap(const void *addr) > } > EXPORT_SYMBOL(vunmap); > > +static inline unsigned int vm_shift(pgprot_t prot, unsigned long size) > +{ > + if (arch_vmap_pmd_supported(prot) && size >= PMD_SIZE) > + return PMD_SHIFT; > + > + return arch_vmap_pte_supported_shift(size); > +} > + > /** > * vmap - map an array of pages into virtually contiguous space > * @pages: array of page pointers > @@ -4047,11 +4055,7 @@ void *__vmalloc_node_range_noprof(unsigned long size, unsigned long align, > * supporting them. > */ > > - if (arch_vmap_pmd_supported(prot) && size >= PMD_SIZE) > - shift = PMD_SHIFT; > - else > - shift = arch_vmap_pte_supported_shift(size); > - > + shift = vm_shift(prot, size); > align = max(original_align, 1UL << shift); > } > > -- > 2.34.1 >