swiotlb: use the calculated number of areas

JIRA: https://issues.redhat.com/browse/RHEL-10094
Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Conflicts: Dynamic swiotlb mempool changes not yet backported, in particular the
           commits 158dbe9c9a3d ("swiotlb: separate memory pool data from other allocator data")
           and 1aaa736815eb ("swiotlb: allocate a new memory pool when existing pools are full")

commit a6a241764f69c62d23fc6960920cc662ae4069e9
Author: Ross Lagerwall <ross.lagerwall@citrix.com>
Date:   Mon Sep 11 11:32:51 2023 +0100

    swiotlb: use the calculated number of areas

    Commit 8ac04063354a ("swiotlb: reduce the number of areas to match
    actual memory pool size") calculated the reduced number of areas in
    swiotlb_init_remap() but didn't actually use the value. Replace usage of
    default_nareas accordingly.

    Fixes: 8ac04063354a ("swiotlb: reduce the number of areas to match actual memory pool size")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>

(cherry picked from commit a6a241764f69c62d23fc6960920cc662ae4069e9)
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
This commit is contained in:
Jerry Snitselaar 2023-09-11 11:32:51 +01:00
parent 44e68a9a11
commit de46fd89a5
1 changed files with 2 additions and 3 deletions

View File

@ -350,14 +350,13 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,
} }
mem->areas = memblock_alloc(array_size(sizeof(struct io_tlb_area), mem->areas = memblock_alloc(array_size(sizeof(struct io_tlb_area),
default_nareas), SMP_CACHE_BYTES); nareas), SMP_CACHE_BYTES);
if (!mem->areas) { if (!mem->areas) {
pr_warn("%s: Failed to allocate mem->areas.\n", __func__); pr_warn("%s: Failed to allocate mem->areas.\n", __func__);
return; return;
} }
swiotlb_init_io_tlb_mem(mem, __pa(tlb), nslabs, flags, false, swiotlb_init_io_tlb_mem(mem, __pa(tlb), nslabs, flags, false, nareas);
default_nareas);
if (flags & SWIOTLB_VERBOSE) if (flags & SWIOTLB_VERBOSE)
swiotlb_print_info(); swiotlb_print_info();