arm64: swiotlb: Reduce the default size if no ZONE_DMA bouncing needed
authorCatalin Marinas <catalin.marinas@arm.com>
Thu, 5 Oct 2023 15:40:30 +0000 (16:40 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 13 Oct 2023 15:10:39 +0000 (16:10 +0100)
commit65033574ade97afccba074d837fd269903a83a9a
treeb6124c5c373f37bb368bd18f0089fb44c048c8de
parent6465e260f48790807eef06b583b38ca9789b6072
arm64: swiotlb: Reduce the default size if no ZONE_DMA bouncing needed

With CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC enabled, the arm64 kernel still
allocates the default SWIOTLB buffer (64MB) even if ZONE_DMA is disabled
or all the RAM fits into this zone. However, this potentially wastes a
non-negligible amount of memory on platforms with little RAM.

Reduce the SWIOTLB size to 1MB per 1GB of RAM if only needed for
kmalloc() buffer bouncing.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Suggested-by: Ross Burton <ross.burton@arm.com>
Cc: Ross Burton <ross.burton@arm.com>
Cc: Will Deacon <will@kernel.org>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
arch/arm64/mm/init.c