From: Sebastian Ott <sebott@linux.vnet.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] lib/iommu-helper: skip to next segment
Date: Wed, 8 Jun 2016 19:11:58 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.20.1606081910070.3211@schleppi> (raw)
When a large enough area in the iommu bitmap is found but would
span a boundary we continue the search starting from the next
bit position. For large allocations this can lead to several
useless invocations of bitmap_find_next_zero_area() and
iommu_is_span_boundary().
Continue the search from the start of the next segment (which is
the next bit position such that we'll not cross the same segment
boundary again).
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
---
lib/iommu-helper.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c
index c27e269..a816f3a 100644
--- a/lib/iommu-helper.c
+++ b/lib/iommu-helper.c
@@ -29,8 +29,7 @@ again:
index = bitmap_find_next_zero_area(map, size, start, nr, align_mask);
if (index < size) {
if (iommu_is_span_boundary(index, nr, shift, boundary_size)) {
- /* we could do more effectively */
- start = index + 1;
+ start = ALIGN(shift + index, boundary_size) - shift;
goto again;
}
bitmap_set(map, index, nr);
--
2.3.0
reply other threads:[~2016-06-08 17:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=alpine.LFD.2.20.1606081910070.3211@schleppi \
--to=sebott@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=gerald.schaefer@de.ibm.com \
--cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).