[PATCH V5 0/2] arm64/mm: Enable batched TLB flush in unmap_hotplug_range()

Anshuman Khandual posted 2 patches 3 weeks, 2 days ago
arch/arm64/mm/mmu.c | 156 +++++++++++++++++++++++++++++++++++++-------
1 file changed, 134 insertions(+), 22 deletions(-)
[PATCH V5 0/2] arm64/mm: Enable batched TLB flush in unmap_hotplug_range()
Posted by Anshuman Khandual 3 weeks, 2 days ago
This series enables batched TLB flush in unmap_hotplug_range() which avoids
individual page TLB flush for potential CONT blocks in linear mapping while
also improving performance due to range based TLB operation along with less
synchronization barrier instructions.

It also now rejects memory removal that might split a leaf entry in kernel
mapping, which would have otherwise required re-structuring using the break
before make (BBM) semantics. But kernel cannot tolerate BBM, so remapping to
fine grained leaves would not be possible on systems without BBML2_NOABORT.

This series applies on 7.0-rc3 and tested on KVM guest.

Changes in V5:

- Fixed all single liner in code comments per David

Changes in V4:

https://lore.kernel.org/all/20260305053148.3765710-1-anshuman.khandual@arm.com/

Accommodated all comments from David H

- Dropped 'size' in can_unmap_without_split()
- Added BUILD_BUG_ON() for SPARSEMEM_VMEMMAP in can_unmap_without_split()
- Added unified comment in addr_splits_kernel_leaf()
- Replaced ALIGNED_DOWN() with IS_ALIGNED()
- Dropped all PXX_SIZE comments in addr_splits_kernel_leaf()
- Dropped the comment in unmap_hotplug_range()
- Dropped the comments about TLB flush being essential for freeing memory
- Replaced the comments regarding CONT blocks
- Replaced the comments as unmap_hotplug_range() flushes TLB for !free_mapped
- Dropped "Fixes:" and "Closes:" tag from [PATCH 2/2], added "Link:" instead

Changes in V3:

https://lore.kernel.org/all/20260224062423.972404-1-anshuman.khandual@arm.com/

- Fixed some typos in the commit message for [PATCH 2/2]
- Dropped copying stable@vger.kernel.org per Ryan

Changes in V2:

https://lore.kernel.org/all/20260203130348.612150-1-anshuman.khandual@arm.com/

- Renamed split_kernel_leaf_boundary() as addr_splits_kernel_leaf()
- Dropped pte_valid()/pmd_leaf() before checking pte_cont()/pmd_cont()
- Changed and dropped variables in can_unmap_without_split()
- Moved can_unmap_without_split() after boot memory check
- Renamed 'prevent_bootmem' as 'prevent_memory' across the board
- Updated commit message in both patches

Changes in V1:

- https://lore.kernel.org/all/20260202042617.504183-1-anshuman.khandual@arm.com/

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Yang Shi <yang@os.amperecomputing.com>
Cc: Christoph Lameter <cl@gentwo.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org

Anshuman Khandual (2):
  arm64/mm: Enable batched TLB flush in unmap_hotplug_range()
  arm64/mm: Reject memory removal that splits a kernel leaf mapping

 arch/arm64/mm/mmu.c | 156 +++++++++++++++++++++++++++++++++++++-------
 1 file changed, 134 insertions(+), 22 deletions(-)

-- 
2.30.2
Re: [PATCH V5 0/2] arm64/mm: Enable batched TLB flush in unmap_hotplug_range()
Posted by Catalin Marinas 7 hours ago
On Mon, 09 Mar 2026 02:57:23 +0000, Anshuman Khandual wrote:
> This series enables batched TLB flush in unmap_hotplug_range() which avoids
> individual page TLB flush for potential CONT blocks in linear mapping while
> also improving performance due to range based TLB operation along with less
> synchronization barrier instructions.
> 
> It also now rejects memory removal that might split a leaf entry in kernel
> mapping, which would have otherwise required re-structuring using the break
> before make (BBM) semantics. But kernel cannot tolerate BBM, so remapping to
> fine grained leaves would not be possible on systems without BBML2_NOABORT.
> 
> [...]

Applied to arm64 (for-next/hotplug-batched-tlbi), thanks!

[1/2] arm64/mm: Enable batched TLB flush in unmap_hotplug_range()
      https://git.kernel.org/arm64/c/48478b9f7913
[2/2] arm64/mm: Reject memory removal that splits a kernel leaf mapping
      https://git.kernel.org/arm64/c/95a58852b0e5