Message ID | 1495094397-9132-2-git-send-email-thunder.leizhen@huawei.com |
---|---|
State | New |
Headers | show |
Series | iommu/iova: improve the allocation performance of dma64 | expand |
diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index 5c88ba7..333a9cc 100644 --- a/drivers/iommu/iova.c +++ b/drivers/iommu/iova.c @@ -291,15 +291,12 @@ private_find_iova(struct iova_domain *iovad, unsigned long pfn) while (node) { struct iova *iova = rb_entry(node, struct iova, node); - /* If pfn falls within iova's range, return iova */ - if ((pfn >= iova->pfn_lo) && (pfn <= iova->pfn_hi)) { - return iova; - } - if (pfn < iova->pfn_lo) node = node->rb_left; - else if (pfn > iova->pfn_lo) + else if (pfn > iova->pfn_hi) node = node->rb_right; + else + return iova; /* pfn falls within iova's range */ } return NULL;