iommu/iova: put free_iova_mem() outside of spinlock iova_rbtree_lock
Subsystems (2)
PATCH v3 1/1 iommu/iova: put free_iova_mem() outside of spinlock iova_rbtree_lock
From: Xiang Chen <[email protected]>
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. And also rename private_free_iova() as remove_iova() because the function will not free iova after that change.
--- drivers/iommu/iova.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/iommu/iova.c +11 -7
@@ -412,12 +412,11 @@ private_find_iova(struct iova_domain *iovad, unsigned long pfn)return NULL ; } -static void private_free_iova (struct iova_domain *iovad,struct iova *iova) +static void remove_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); }/**
@@ -452,8 +451,9 @@ __free_iova(struct iova_domain *iovad, struct iova *iova)unsigned long flags;spin_lock_irqsave (&iovad->iova_rbtree_lock, flags); -private_free_iova (iovad, iova); +remove_iova (iovad, iova);spin_unlock_irqrestore (&iovad->iova_rbtree_lock, flags); +free_iova_mem (iova); }EXPORT_SYMBOL_GPL (__free_iova);
@@ -472,10 +472,13 @@ free_iova(struct iova_domain *iovad, unsigned long pfn)spin_lock_irqsave (&iovad->iova_rbtree_lock, flags); iova =private_find_iova (iovad, pfn); -if (iova) -private_free_iova (iovad, iova); +if (!iova) { +spin_unlock_irqrestore (&iovad->iova_rbtree_lock, flags); +return ; + } +remove_iova (iovad, iova);spin_unlock_irqrestore (&iovad->iova_rbtree_lock, flags); - +free_iova_mem (iova); }EXPORT_SYMBOL_GPL (free_iova);
@@ -825,7 +828,8 @@ iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad)if (WARN_ON (!iova))continue ; -private_free_iova (iovad, iova); +remove_iova (iovad, iova); +free_iova_mem (iova); }spin_unlock_irqrestore (&iovad->iova_rbtree_lock, flags);
Signature · 6 lines
2.8.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 9 lines · chenxiang
From: Xiang Chen<[email protected]>
It is not necessary to put
free_iova_mem()inside of spinlock/unlockiova_rbtree_lockwhich only leads to more completion for the spinlock. It has a small promote on the performance after the change. And also renameprivate_free_iova()asremove_iova()because the function will not free iova after that change.Signed-off-by Xiang Chen<[email protected]>
I think that you will need to resend after v5.13-rc1 comes out, however:
Quoted 2 lines
---
drivers/iommu/
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Joerg Roedel
maintainerQuoted 8 lines · chenxiang
From: Xiang Chen <[email protected]>
It is not necessary to put
free_iova_mem()inside of spinlock/unlockiova_rbtree_lockwhich only leads to more completion for the spinlock. It has a small promote on the performance after the change. And also renameprivate_free_iova()asremove_iova()because the function will not free iova after that change.
Quoted 4 lines
Signed-off-by Xiang Chen <[email protected]>--- drivers/iommu/iova.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
Looks good to me, but I'll wait for Robins opinion before applying.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Hi Joerg,
Quoted 9 lines · Joerg Roedel
Quoted 8 lines · chenxiang
From: Xiang Chen <[email protected]>
It is not necessary to put
free_iova_mem()inside of spinlock/unlockiova_rbtree_lockwhich only leads to more completion for the spinlock. It has a small promote on the performance after the change. And also renameprivate_free_iova()asremove_iova()because the function will not free iova after that change.
Quoted 5 lines
Quoted 4 lines
Signed-off-by Xiang Chen <[email protected]>--- drivers/iommu/iova.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)Looks good to me, but I'll wait for Robins opinion before applying.
I have re-sent v3, and Robin has given his acked-by:
https://www.mail-archive.com/[email protected]/msg50950.html
Quoted 4 lines
.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Robin Murphy
maintainerQuoted 9 lines · Joerg Roedel
Quoted 8 lines · chenxiang
From: Xiang Chen <[email protected]>
It is not necessary to put
free_iova_mem()inside of spinlock/unlockiova_rbtree_lockwhich only leads to more completion for the spinlock. It has a small promote on the performance after the change. And also renameprivate_free_iova()asremove_iova()because the function will not free iova after that change.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Xiang Chen <[email protected]>--- drivers/iommu/iova.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)Looks good to me, but I'll wait for Robins opinion before applying.
Go ahead - I acked the resend[1] :)
Thanks,
Robin.
[1] https://lore.kernel.org/linux-iommu/[email protected]/
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Joerg Roedel
maintainerQuoted 1 line · Joerg Roedel
Looks good to me, but I'll wait for Robins opinion before applying.
Nevermind, just found the new version which Robin already acked.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu