On 2021-04-14 07:38, chenxiang wrote:
From: Xiang Chen chenxiang66@hisilicon.com
It is not necessary to put free_iova_mem() inside of spinlock/unlock iova_rbtree_lock which only leads to more completion for the spinlock. It has a small promote on the performance after the change.
This seems not entirely unreasonable, but private_free_iova() really needs to be renamed (maybe something like remove_iova()?) if it's no longer actually freeing anything - otherwise it's just unnecessarily misleading.
Robin.
Signed-off-by: Xiang Chen chenxiang66@hisilicon.com
drivers/iommu/iova.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index c669526f..292ed4a 100644 --- a/drivers/iommu/iova.c +++ b/drivers/iommu/iova.c @@ -339,7 +339,6 @@ static void private_free_iova(struct iova_domain *iovad, struct iova *iova) assert_spin_locked(&iovad->iova_rbtree_lock); __cached_rbnode_delete_update(iovad, iova); rb_erase(&iova->node, &iovad->rbroot);
free_iova_mem(iova); }
/**
@@ -376,6 +375,7 @@ __free_iova(struct iova_domain *iovad, struct iova *iova) spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); private_free_iova(iovad, iova); spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags);
- free_iova_mem(iova); } EXPORT_SYMBOL_GPL(__free_iova);
@@ -397,7 +397,7 @@ free_iova(struct iova_domain *iovad, unsigned long pfn) if (iova) private_free_iova(iovad, iova); spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags);
- free_iova_mem(iova); } EXPORT_SYMBOL_GPL(free_iova);
@@ -746,6 +746,7 @@ iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad) continue;
private_free_iova(iovad, iova);
free_iova_mem(iova);
}
spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags);