lkml.org 
[lkml]   [2020]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] iommu/iova: Replace cmpxchg with xchg in queue_iova
From
Date
Hi Joerg,

On 2020-09-04 10:37, Joerg Roedel wrote:
> Adding Robin.

Did you miss that I've reviewed this already? :)

https://lore.kernel.org/linux-iommu/3afcc7b2-0bfb-b79c-513f-1beb66c5f164@arm.com/

Robin.

> On Thu, Aug 27, 2020 at 04:43:54PM +0800, Shaokun Zhang wrote:
>> From: Yuqi Jin <jinyuqi@huawei.com>
>>
>> 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.
>>
>> Cc: Joerg Roedel <joro@8bytes.org>
>> Signed-off-by: Yuqi Jin <jinyuqi@huawei.com>
>> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
>> ---
>> drivers/iommu/iova.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
>> index 45a251da5453..30d969a4c5fd 100644
>> --- a/drivers/iommu/iova.c
>> +++ b/drivers/iommu/iova.c
>> @@ -579,7 +579,7 @@ void queue_iova(struct iova_domain *iovad,
>>
>> /* Avoid false sharing as much as possible. */
>> if (!atomic_read(&iovad->fq_timer_on) &&
>> - !atomic_cmpxchg(&iovad->fq_timer_on, 0, 1))
>> + !atomic_xchg(&iovad->fq_timer_on, 1))
>> mod_timer(&iovad->fq_timer,
>> jiffies + msecs_to_jiffies(IOVA_FQ_TIMEOUT));
>> }
>> --
>> 2.7.4
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu
>

\
 
 \ /
  Last update: 2020-09-04 11:58    [W:0.121 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site