summaryrefslogtreecommitdiffstats
path: root/mm/slab_common.c
diff options
context:
space:
mode:
authorPetr Tesarik <petr.tesarik.ext@huawei.com>2023-08-01 08:23:57 +0200
committerChristoph Hellwig <hch@lst.de>2023-08-01 18:02:09 +0200
commit05ee774122bd4a2f298668d6d5fc9e7b685a5e31 (patch)
tree7144d0ef02ca1d93c0355de1ad5fa8349dadd3db /mm/slab_common.c
parentswiotlb: bail out of swiotlb_init_late() if swiotlb is already allocated (diff)
downloadlinux-05ee774122bd4a2f298668d6d5fc9e7b685a5e31.tar.xz
linux-05ee774122bd4a2f298668d6d5fc9e7b685a5e31.zip
swiotlb: make io_tlb_default_mem local to swiotlb.c
SWIOTLB implementation details should not be exposed to the rest of the kernel. This will allow to make changes to the implementation without modifying non-swiotlb code. To avoid breaking existing users, provide helper functions for the few required fields. As a bonus, using a helper function to initialize struct device allows to get rid of an #ifdef in driver core. Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'mm/slab_common.c')
-rw-r--r--mm/slab_common.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/mm/slab_common.c b/mm/slab_common.c
index d1555ea2981a..c639dba9a3b7 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -864,10 +864,9 @@ void __init setup_kmalloc_cache_index_table(void)
static unsigned int __kmalloc_minalign(void)
{
-#ifdef CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC
- if (io_tlb_default_mem.nslabs)
+ if (IS_ENABLED(CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC) &&
+ is_swiotlb_allocated())
return ARCH_KMALLOC_MINALIGN;
-#endif
return dma_get_cache_alignment();
}