]> git.dujemihanovic.xyz Git - linux.git/commit
iommu/vt-d: Use try_cmpxchg64{,_local}() in iommu.c
authorUros Bizjak <ubizjak@gmail.com>
Wed, 24 Apr 2024 07:16:28 +0000 (15:16 +0800)
committerJoerg Roedel <jroedel@suse.de>
Fri, 26 Apr 2024 09:57:36 +0000 (11:57 +0200)
commit9e7ee0f045395dc8aa55fbdc164c062484f4c88d
tree3b06b0fe95ec1e9d3fd6d66e9e236809ea5b543a
parenta770ccd91d99f997e023b554d9e2033ce79e019e
iommu/vt-d: Use try_cmpxchg64{,_local}() in iommu.c

Replace this pattern in iommu.c:

    cmpxchg64{,_local}(*ptr, 0, new) != 0

... with the simpler and faster:

    !try_cmpxchg64{,_local}(*ptr, &tmp, new)

The x86 CMPXCHG instruction returns success in the ZF flag, so this change
saves a compare after the CMPXCHG.

No functional change intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Will Deacon <will@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20240414162454.49584-1-ubizjak@gmail.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/intel/iommu.c