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 1F1D4345CD3 for ; Tue, 14 Jul 2026 06:45:53 +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=1784011556; cv=none; b=B5kApNcFJQQ4BB5AfMqbIqDil89WYaa4g0jrhfZQpPi28d4yFfpxhFCVBbyI8L79jTtHyOdLx/u6DzE230syxPiduEHFLXC5EecACDK11qqs/81WO4Ma3SFrDyLXSLejVJuRCNolKB+sgZIUnczIbmGDRcxQ4bnqjl8Vxid2FHA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784011556; c=relaxed/simple; bh=Hc0hzyscuk80FwBKUVOH73LX4dEOMupwQvGYeR9hS2E=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=kQ6DUUkpg2899Rh6wSDvIFzd4GAN4k3FL3LYdWKjUUXIG5pNQPgnV7rHkjUDCMrUCbrCBrU+EK66mrJH1X8DMK8odeB6FEIw/1lJKGVtxiy+BQqt/gckQwrKWAn0mv7t9Fwb9rLsPHsXY+mkZhN+EQCrWe5/oSV4bM8HeNUj1+8= 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=mjdADVBa; 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="mjdADVBa" 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 C9BA11477; Mon, 13 Jul 2026 23:45:48 -0700 (PDT) Received: from [10.164.19.52] (unknown [10.164.19.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B287D3F7B4; Mon, 13 Jul 2026 23:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1784011553; bh=Hc0hzyscuk80FwBKUVOH73LX4dEOMupwQvGYeR9hS2E=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=mjdADVBavbIfoQjjnjGAOKAsOn2SXw9RUkr+c9HkpzsjGg5F87xy9VajsbDz/hcD6 uKVLLFNAx7UapzoLhWhvYbppY8tZqx610mKhSI2M1QU0flV3xrwBv3jOGyHyM0n4mC z1k1iHtkbnzeurZPkAHfsX9+cb2E+pFI9TkHTGgo= Message-ID: <945bdf1a-10f8-41fd-956e-af40af809c7b@arm.com> Date: Tue, 14 Jul 2026 12:15:45 +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 v6 4/6] mm/vmalloc: Extend page table walk to support larger page_shift sizes and eliminate page table rewalk To: Wen Jiang Cc: akpm@linux-foundation.org, catalin.marinas@arm.com, linux-mm@kvack.org, urezki@gmail.com, will@kernel.org, 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, "Barry Song (Xiaomi)" , Wen Jiang , Leo Yan References: <20260709073823.6643-1-jiangwen6@xiaomi.com> <20260709073823.6643-5-jiangwen6@xiaomi.com> <85a3a79a-2a78-47ed-bd93-48e8f1967551@arm.com> Content-Language: en-US From: Dev Jain In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 14/07/26 11:40 am, Wen Jiang wrote: > On Mon, 13 Jul 2026 at 21:49, Dev Jain wrote: >> >> >> >> On 09/07/26 1:08 pm, Wen Jiang wrote: >>> From: "Barry Song (Xiaomi)" >>> >>> vmap_pages_range_noflush_walk() (formerly vmap_small_pages_range_noflush()) >>> provides a clean interface by taking struct page **pages and mapping them >>> via direct PTE iteration. This avoids the page table rewalk seen when >>> using vmap_range_noflush() for page_shift values other than PAGE_SHIFT. >>> >>> Extend it to support larger page_shift values, and add PMD- and >>> contiguous-PTE mappings as well. Rename it to vmap_pages_range_noflush_walk() >>> since it now handles more than just small pages. >>> >>> For vmalloc() allocations with VM_ALLOW_HUGE_VMAP, we no longer need to >>> iterate over pages one by one via vmap_range_noflush(), which would >>> otherwise lead to page table rewalk. The code is now unified with the >>> PAGE_SHIFT case by simply calling vmap_pages_range_noflush_walk(). >>> >>> Signed-off-by: Barry Song (Xiaomi) >>> Signed-off-by: Wen Jiang >>> Tested-by: Xueyuan Chen >>> Tested-by: Leo Yan >>> Reviewed-by: Dev Jain >>> --- >>> mm/vmalloc.c | 81 ++++++++++++++++++++++++++++++---------------------- >>> 1 file changed, 47 insertions(+), 34 deletions(-) >>> >>> diff --git a/mm/vmalloc.c b/mm/vmalloc.c >>> index d7fef85b241c4..d2a4d649af549 100644 >>> --- a/mm/vmalloc.c >>> +++ b/mm/vmalloc.c >>> @@ -125,7 +125,8 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, >>> pte_t *pte; >>> u64 pfn; >>> struct page *page; >>> - unsigned long size = PAGE_SIZE; >>> + unsigned long size; >>> + unsigned int steps; >>> >>> if (WARN_ON_ONCE(!PAGE_ALIGNED(end - addr))) >>> return -EINVAL; >>> @@ -147,8 +148,8 @@ static int vmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, >>> } >>> >>> size = vmap_set_ptes(pte, addr, end, pfn, prot, max_page_shift); >>> - pfn += PFN_DOWN(size); >>> - } while (pte += PFN_DOWN(size), addr += size, addr != end); >>> + steps = PFN_DOWN(size); >>> + } while (pte += steps, pfn += steps, addr += size, addr != end); >> >> I think I had also recommended to put these vmap_pte_range() changes >> into the previous patch. >> > > Hi Dev > > I put this change in patch 4 following Uladzislau's earlier suggestion: > > https://lore.kernel.org/linux-mm/ah3Cn3YnefIVJDo2@milan/ > > Uladzislau, do you have a preference on where this hunk should go? > Sorry if I wasn't clear enough. I am not contradicting Uladzislau's comment - separate patch 3 and 4 are good. I was just commenting on the specific change you did here w.r.t vmap_pte_range. The only bit you change above is to introduce a local variable 'steps'. You can move this bit into the previous patch, so that patch 4 is completely focussed on extending the vmap_pages_* functions to accept a 'shift'. > Thanks, > Wen