From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH] drm/ttm: do not check if list is empty in ttm_bo_force_list_clean
Date: Fri, 12 Oct 2012 17:15:43 +0200 [thread overview]
Message-ID: <5078341F.2030507@canonical.com> (raw)
Just use the return error from ttm_mem_evict_first instead.
Since ttm_mem_evict_first does the same check, the error message
from that function can be used.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
---
drivers/gpu/drm/ttm/ttm_bo.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 3039137..f6d7026 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1315,29 +1315,18 @@ EXPORT_SYMBOL(ttm_bo_create);
static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
unsigned mem_type, bool allow_errors)
{
- struct ttm_mem_type_manager *man = &bdev->man[mem_type];
- struct ttm_bo_global *glob = bdev->glob;
- int ret;
-
- /*
- * Can't use standard list traversal since we're unlocking.
- */
+ int ret = 0;
- spin_lock(&glob->lru_lock);
- while (!list_empty(&man->lru)) {
- spin_unlock(&glob->lru_lock);
+ while (!ret) {
ret = ttm_mem_evict_first(bdev, mem_type, false, false, false);
- if (ret) {
- if (allow_errors) {
- return ret;
- } else {
- pr_err("Cleanup eviction failed\n");
- }
+ if (ret == -EBUSY)
+ return 0;
+ else if (ret && !allow_errors) {
+ pr_err("Cleanup eviction failed\n");
+ ret = 0;
}
- spin_lock(&glob->lru_lock);
}
- spin_unlock(&glob->lru_lock);
- return 0;
+ return ret;
}
int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type)
reply other threads:[~2012-10-12 15:15 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=5078341F.2030507@canonical.com \
--to=maarten.lankhorst@canonical.com \
--cc=dri-devel@lists.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 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.