Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 345569
b: refs/heads/master
c: e7ab201
h: refs/heads/master
i:
  345567: b13bf09
v: v3
  • Loading branch information
Maarten Lankhorst authored and Dave Airlie committed Dec 10, 2012
1 parent efb6d1f commit d60eba3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 32 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2b7b3ad2fb8f904ae9ba7ca71323bc11c0978d91
refs/heads/master: e7ab20197be3ee5fd75441e1cff0c7cdfea5bf1a
42 changes: 11 additions & 31 deletions trunk/drivers/gpu/drm/ttm/ttm_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -811,49 +811,29 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev,
struct ttm_bo_global *glob = bdev->glob;
struct ttm_mem_type_manager *man = &bdev->man[mem_type];
struct ttm_buffer_object *bo;
int ret, put_count = 0;
int ret = -EBUSY, put_count;

retry:
spin_lock(&glob->lru_lock);
if (list_empty(&man->lru)) {
list_for_each_entry(bo, &man->lru, lru) {
ret = ttm_bo_reserve_locked(bo, false, true, false, 0);
if (!ret)
break;
}

if (ret) {
spin_unlock(&glob->lru_lock);
return -EBUSY;
return ret;
}

bo = list_first_entry(&man->lru, struct ttm_buffer_object, lru);
kref_get(&bo->list_kref);

if (!list_empty(&bo->ddestroy)) {
ret = ttm_bo_reserve_locked(bo, interruptible, no_wait_reserve, false, 0);
if (!ret)
ret = ttm_bo_cleanup_refs_and_unlock(bo, interruptible,
no_wait_gpu);
else
spin_unlock(&glob->lru_lock);

ret = ttm_bo_cleanup_refs_and_unlock(bo, interruptible,
no_wait_gpu);
kref_put(&bo->list_kref, ttm_bo_release_list);

return ret;
}

ret = ttm_bo_reserve_locked(bo, false, true, false, 0);

if (unlikely(ret == -EBUSY)) {
spin_unlock(&glob->lru_lock);
if (likely(!no_wait_reserve))
ret = ttm_bo_wait_unreserved(bo, interruptible);

kref_put(&bo->list_kref, ttm_bo_release_list);

/**
* We *need* to retry after releasing the lru lock.
*/

if (unlikely(ret != 0))
return ret;
goto retry;
}

put_count = ttm_bo_del_from_lru(bo);
spin_unlock(&glob->lru_lock);

Expand Down

0 comments on commit d60eba3

Please sign in to comment.