From: Zhen Lei <thunder.leizhen@huawei.com>
To: Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
"Joerg Roedel" <joro@8bytes.org>,
iommu <iommu@lists.linux-foundation.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Cc: Vijayanand Jitta <vjitta@codeaurora.org>
Subject: [PATCH 1/1] Revert "iommu/iova: Retry from last rb tree node if iova search fails"
Date: Fri, 29 Jan 2021 17:21:20 +0800 [thread overview]
Message-ID: <20210129092120.1482-1-thunder.leizhen@huawei.com> (raw)
This reverts commit 4e89dce725213d3d0b0475211b500eda4ef4bf2f.
We find that this patch has a great impact on performance. According to
our test: the iops decreases from 1655.6K to 893.5K, about half.
Hardware: 1 SAS expander with 12 SAS SSD
Command: Only the main parameters are listed.
fio bs=4k rw=read iodepth=128 cpus_allowed=0-127
Fixes: 4e89dce72521 ("iommu/iova: Retry from last rb tree node if iova search fails")
Tested-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/iommu/iova.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index d20b8b333d30d17..f840c7207efbced 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -185,9 +185,8 @@ static int __alloc_and_insert_iova_range(struct iova_domain *iovad,
struct rb_node *curr, *prev;
struct iova *curr_iova;
unsigned long flags;
- unsigned long new_pfn, retry_pfn;
+ unsigned long new_pfn;
unsigned long align_mask = ~0UL;
- unsigned long high_pfn = limit_pfn, low_pfn = iovad->start_pfn;
if (size_aligned)
align_mask <<= fls_long(size - 1);
@@ -200,25 +199,15 @@ static int __alloc_and_insert_iova_range(struct iova_domain *iovad,
curr = __get_cached_rbnode(iovad, limit_pfn);
curr_iova = rb_entry(curr, struct iova, node);
- retry_pfn = curr_iova->pfn_hi + 1;
-
-retry:
do {
- high_pfn = min(high_pfn, curr_iova->pfn_lo);
- new_pfn = (high_pfn - size) & align_mask;
+ limit_pfn = min(limit_pfn, curr_iova->pfn_lo);
+ new_pfn = (limit_pfn - size) & align_mask;
prev = curr;
curr = rb_prev(curr);
curr_iova = rb_entry(curr, struct iova, node);
- } while (curr && new_pfn <= curr_iova->pfn_hi && new_pfn >= low_pfn);
-
- if (high_pfn < size || new_pfn < low_pfn) {
- if (low_pfn == iovad->start_pfn && retry_pfn < limit_pfn) {
- high_pfn = limit_pfn;
- low_pfn = retry_pfn;
- curr = &iovad->anchor.node;
- curr_iova = rb_entry(curr, struct iova, node);
- goto retry;
- }
+ } while (curr && new_pfn <= curr_iova->pfn_hi);
+
+ if (limit_pfn < size || new_pfn < iovad->start_pfn) {
iovad->max32_alloc_size = size;
goto iova32_full;
}
--
1.8.3
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next reply other threads:[~2021-01-29 9:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-29 9:21 Zhen Lei [this message]
2021-01-29 9:48 ` [PATCH 1/1] Revert "iommu/iova: Retry from last rb tree node if iova search fails" Leizhen (ThunderTown)
2021-01-29 12:03 ` Robin Murphy
2021-01-29 12:43 ` chenxiang (M)
2021-02-25 13:54 ` John Garry
2021-02-25 13:54 ` John Garry
2021-03-01 13:20 ` Robin Murphy
2021-03-01 13:20 ` Robin Murphy
2021-03-01 15:48 ` John Garry
2021-03-01 15:48 ` John Garry
2021-03-02 12:30 ` John Garry
2021-03-02 12:30 ` John Garry
2021-03-08 15:15 ` Robin Murphy
2021-03-08 15:15 ` Robin Murphy
2021-03-08 16:22 ` John Garry
2021-03-08 16:22 ` John Garry
2021-03-10 17:50 ` John Garry
2021-03-10 17:50 ` John Garry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210129092120.1482-1-thunder.leizhen@huawei.com \
--to=thunder.leizhen@huawei.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=vjitta@codeaurora.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.