From: Monk Liu <Monk.Liu@amd.com>
To: dri-devel@freedesktop.org
Cc: Monk Liu <Monk.Liu@amd.com>
Subject: [PATCH] drm: should return upon the best size(v3)
Date: Tue, 27 Nov 2018 11:10:34 +0800 [thread overview]
Message-ID: <1543288234-12155-1-git-send-email-Monk.Liu@amd.com> (raw)
v2:
amend description:
for RB tree traveler we don't need to travel to
the bottom level if already found the equal size node,
thus the search performance can get improved.
v3:
split "<=" to "<" case and "==" case
Tested-by: Rex Zhu <Rex.zhu@amd.com>
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
drivers/gpu/drm/drm_mm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 3cc5fbd..c966610 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -315,9 +315,11 @@ static struct drm_mm_node *best_hole(struct drm_mm *mm, u64 size)
struct drm_mm_node *node =
rb_entry(rb, struct drm_mm_node, rb_hole_size);
- if (size <= node->hole_size) {
+ if (size < node->hole_size) {
best = node;
rb = rb->rb_right;
+ } else if (size == node->hole_size) {
+ return node;
} else {
rb = rb->rb_left;
}
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2018-11-27 3:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-27 3:10 Monk Liu [this message]
2018-11-27 9:20 ` [PATCH] drm: should return upon the best size(v3) Chris Wilson
2018-11-27 10:00 ` Christian König
2018-11-27 12:54 ` Christian König
2018-11-27 13:40 ` Liu, Monk
2018-11-27 13:48 ` Christian König
2018-11-27 14:10 ` Liu, Monk
2018-11-27 14:13 ` Liu, Monk
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=1543288234-12155-1-git-send-email-Monk.Liu@amd.com \
--to=monk.liu@amd.com \
--cc=dri-devel@freedesktop.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