Commit 5d62bacc authored by Zhen Lei's avatar Zhen Lei Committed by Joerg Roedel

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: default avatarRobin Murphy <robin.murphy@arm.com>
Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
Link: https://lore.kernel.org/r/20230421072422.869-1-thunder.leizhen@huawei.comSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 44c026a7
...@@ -647,7 +647,13 @@ struct iova_rcache { ...@@ -647,7 +647,13 @@ struct iova_rcache {
static struct iova_magazine *iova_magazine_alloc(gfp_t flags) 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) static void iova_magazine_free(struct iova_magazine *mag)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment