Re: [PATCH RESEND v5 2/5] iova: Allow rcache range upper limit to be flexible

From: Will Deacon
Date: Wed Jul 06 2022 - 08:11:25 EST


On Mon, Apr 04, 2022 at 07:27:11PM +0800, John Garry wrote:
> Some low-level drivers may request DMA mappings whose IOVA length exceeds
> that of the current rcache upper limit.
>
> This means that allocations for those IOVAs will never be cached, and
> always must be allocated and freed from the RB tree per DMA mapping cycle.
> This has a significant effect on performance, more so since commit
> 4e89dce72521 ("iommu/iova: Retry from last rb tree node if iova search
> fails"), as discussed at [0].
>
> As a first step towards allowing the rcache range upper limit be
> configured, hold this value in the IOVA rcache structure, and allocate
> the rcaches separately.
>
> Delete macro IOVA_RANGE_CACHE_MAX_SIZE in case it's reused by mistake.
>
> [0] https://lore.kernel.org/linux-iommu/20210129092120.1482-1-thunder.leizhen@xxxxxxxxxx/
>
> Signed-off-by: John Garry <john.garry@xxxxxxxxxx>
> ---
> drivers/iommu/iova.c | 20 ++++++++++----------
> include/linux/iova.h | 3 +++
> 2 files changed, 13 insertions(+), 10 deletions(-)

Acked-by: Will Deacon <will@xxxxxxxxxx>

Will