]> asedeno.scripts.mit.edu Git - linux.git/commit
iommu/iova: Avoid false sharing on fq_timer_on
authorEric Dumazet <edumazet@google.com>
Wed, 28 Aug 2019 13:13:38 +0000 (06:13 -0700)
committerJoerg Roedel <jroedel@suse.de>
Fri, 30 Aug 2019 13:21:53 +0000 (15:21 +0200)
commit0d87308cca2c124f9bce02383f1d9632c9be89c4
treedf09ed34fee40075a99173dc78273b75d0aa8736
parentc8fb436b3b633183a4c2b5a958c01baaf8bc42a7
iommu/iova: Avoid false sharing on fq_timer_on

In commit 14bd9a607f90 ("iommu/iova: Separate atomic variables
to improve performance") Jinyu Qi identified that the atomic_cmpxchg()
in queue_iova() was causing a performance loss and moved critical fields
so that the false sharing would not impact them.

However, avoiding the false sharing in the first place seems easy.
We should attempt the atomic_cmpxchg() no more than 100 times
per second. Adding an atomic_read() will keep the cache
line mostly shared.

This false sharing came with commit 9a005a800ae8
("iommu/iova: Add flush timer").

Signed-off-by: Eric Dumazet <edumazet@google.com>
Fixes: 9a005a800ae8 ('iommu/iova: Add flush timer')
Cc: Jinyu Qi <jinyuqi@huawei.com>
Cc: Joerg Roedel <jroedel@suse.de>
Acked-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iova.c