diff options
author | Robin Murphy <robin.murphy@arm.com> | 2016-11-11 18:35:46 +0000 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2016-11-15 12:39:52 +0100 |
commit | 62280cf2e8bb46d14b47b198720ab2d69b43faf7 (patch) | |
tree | 7134cc1db3960d9f5912244d05fbbac90e37496a | |
parent | 5d1d43b0f6231cfffde61f8774283f170c040776 (diff) | |
download | linux-62280cf2e8bb46d14b47b198720ab2d69b43faf7.tar.bz2 |
iommu/iova: Extend cached node lookup condition
When searching for a free IOVA range, we optimise the tree traversal
by starting from the cached32_node, instead of the last node, when
limit_pfn is equal to dma_32bit_pfn. However, if limit_pfn happens to
be smaller, then we'll go ahead and start from the top even though
dma_32bit_pfn is still a more suitable upper bound. Since this is
clearly a silly thing to do, adjust the lookup condition appropriately.
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r-- | drivers/iommu/iova.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index e23001bfcfee..080beca0197d 100644 --- a/drivers/iommu/iova.c +++ b/drivers/iommu/iova.c @@ -56,7 +56,7 @@ EXPORT_SYMBOL_GPL(init_iova_domain); static struct rb_node * __get_cached_rbnode(struct iova_domain *iovad, unsigned long *limit_pfn) { - if ((*limit_pfn != iovad->dma_32bit_pfn) || + if ((*limit_pfn > iovad->dma_32bit_pfn) || (iovad->cached32_node == NULL)) return rb_last(&iovad->rbroot); else { |