iommu/iova: Replace cmpxchg with xchg in queue_iova
authorYuqi Jin <jinyuqi@huawei.com>
Thu, 27 Aug 2020 08:43:54 +0000 (16:43 +0800)
committerJoerg Roedel <jroedel@suse.de>
Fri, 4 Sep 2020 10:11:06 +0000 (12:11 +0200)
commitba328f82613260a098de7b4aff58743cd8733507
treee5640a2d5d96de57d1d679e81804ac45f1fec9c7
parent4604393ca0c6e4a73c04798c3f1d9878e70b7251
iommu/iova: Replace cmpxchg with xchg in queue_iova

The performance of the atomic_xchg is better than atomic_cmpxchg because
no comparison is required. While the value of @fq_timer_on can only be 0
or 1. Let's use atomic_xchg instead of atomic_cmpxchg here because we
only need to check that the value changes from 0 to 1 or from 1 to 1.

Signed-off-by: Yuqi Jin <jinyuqi@huawei.com>
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Cc: Joerg Roedel <joro@8bytes.org>
Link: https://lore.kernel.org/r/1598517834-30275-1-git-send-email-zhangshaokun@hisilicon.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iova.c