aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhen Lei <[email protected]>2023-04-21 15:24:21 +0800
committerJoerg Roedel <[email protected]>2023-05-22 17:09:51 +0200
commit5d62bacc059bb4f783e1d2ad88874abb6056f404 (patch)
tree043ae8b9a2d5a2db9a974d80c9a190b6bdfb70a0
parent44c026a73be8038f03dbdeef028b642880cf1511 (diff)
iommu/iova: Optimize iova_magazine_alloc()
Only the member 'size' needs to be initialized to 0. Clearing the array pfns[], which is about 1 KiB in size, not only wastes time, but also causes cache pollution. Acked-by: Robin Murphy <[email protected]> Signed-off-by: Zhen Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
-rw-r--r--drivers/iommu/iova.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index fe452ce46642..10b964600948 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -647,7 +647,13 @@ struct iova_rcache {
static struct iova_magazine *iova_magazine_alloc(gfp_t flags)
{
- return kzalloc(sizeof(struct iova_magazine), flags);
+ struct iova_magazine *mag;
+
+ mag = kmalloc(sizeof(*mag), flags);
+ if (mag)
+ mag->size = 0;
+
+ return mag;
}
static void iova_magazine_free(struct iova_magazine *mag)