Skip to content

Commit

Permalink
swiotlb: use the calculated number of areas
Browse files Browse the repository at this point in the history
Commit 8ac0406 ("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: 8ac0406 ("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>
  • Loading branch information
Ross Lagerwall authored and Christoph Hellwig committed Sep 13, 2023
1 parent 0bb80ec commit a6a2417
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions kernel/dma/swiotlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,14 +399,13 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,
}

mem->areas = memblock_alloc(array_size(sizeof(struct io_tlb_area),
default_nareas), SMP_CACHE_BYTES);
nareas), SMP_CACHE_BYTES);
if (!mem->areas) {
pr_warn("%s: Failed to allocate mem->areas.\n", __func__);
return;
}

swiotlb_init_io_tlb_pool(mem, __pa(tlb), nslabs, false,
default_nareas);
swiotlb_init_io_tlb_pool(mem, __pa(tlb), nslabs, false, nareas);
add_mem_pool(&io_tlb_default_mem, mem);

if (flags & SWIOTLB_VERBOSE)
Expand Down

0 comments on commit a6a2417

Please sign in to comment.