[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240227090807.82318-1-liucong2@kylinos.cn>
Date: Tue, 27 Feb 2024 17:08:07 +0800
From: Cong Liu <liucong2@...inos.cn>
To: Robin Murphy <robin.murphy@....com>,
Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>
Cc: Cong Liu <liucong2@...inos.cn>,
iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: [PATCH] iommu/iova: Simplify IOVA cache allocation with KMEM_CACHE()
Use the new KMEM_CACHE() macro instead of direct kmem_cache_create
to simplify the creation of SLAB caches.
Signed-off-by: Cong Liu <liucong2@...inos.cn>
---
drivers/iommu/iova.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index d59d0ea2fd21..9134acae76f5 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -950,14 +950,11 @@ int iova_cache_get(void)
mutex_lock(&iova_cache_mutex);
if (!iova_cache_users) {
- iova_cache = kmem_cache_create("iommu_iova", sizeof(struct iova), 0,
- SLAB_HWCACHE_ALIGN, NULL);
+ iova_cache = KMEM_CACHE(iova, SLAB_HWCACHE_ALIGN);
if (!iova_cache)
goto out_err;
- iova_magazine_cache = kmem_cache_create("iommu_iova_magazine",
- sizeof(struct iova_magazine),
- 0, SLAB_HWCACHE_ALIGN, NULL);
+ iova_magazine_cache = KMEM_CACHE(iova_magazine, SLAB_HWCACHE_ALIGN);
if (!iova_magazine_cache)
goto out_err;
--
2.34.1
Powered by blists - more mailing lists