|
@@ -164,7 +164,6 @@ static void ttm_bo_release_list(struct kref *list_kref)
|
|
|
void ttm_bo_add_to_lru(struct ttm_buffer_object *bo)
|
|
|
{
|
|
|
struct ttm_bo_device *bdev = bo->bdev;
|
|
|
- struct ttm_mem_type_manager *man;
|
|
|
|
|
|
lockdep_assert_held(&bo->resv->lock.base);
|
|
|
|
|
@@ -172,12 +171,11 @@ void ttm_bo_add_to_lru(struct ttm_buffer_object *bo)
|
|
|
|
|
|
BUG_ON(!list_empty(&bo->lru));
|
|
|
|
|
|
- man = &bdev->man[bo->mem.mem_type];
|
|
|
- list_add_tail(&bo->lru, &man->lru);
|
|
|
+ list_add(&bo->lru, bdev->driver->lru_tail(bo));
|
|
|
kref_get(&bo->list_kref);
|
|
|
|
|
|
if (bo->ttm && !(bo->ttm->page_flags & TTM_PAGE_FLAG_SG)) {
|
|
|
- list_add_tail(&bo->swap, &bo->glob->swap_lru);
|
|
|
+ list_add(&bo->swap, bdev->driver->swap_lru_tail(bo));
|
|
|
kref_get(&bo->list_kref);
|
|
|
}
|
|
|
}
|
|
@@ -230,7 +228,6 @@ EXPORT_SYMBOL(ttm_bo_del_sub_from_lru);
|
|
|
void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo)
|
|
|
{
|
|
|
struct ttm_bo_device *bdev = bo->bdev;
|
|
|
- struct ttm_mem_type_manager *man;
|
|
|
|
|
|
lockdep_assert_held(&bo->resv->lock.base);
|
|
|
|
|
@@ -242,15 +239,29 @@ void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo)
|
|
|
list_del_init(&bo->lru);
|
|
|
|
|
|
} else {
|
|
|
- if (bo->ttm && !(bo->ttm->page_flags & TTM_PAGE_FLAG_SG))
|
|
|
- list_move_tail(&bo->swap, &bo->glob->swap_lru);
|
|
|
+ if (bo->ttm && !(bo->ttm->page_flags & TTM_PAGE_FLAG_SG)) {
|
|
|
+ list_del(&bo->swap);
|
|
|
+ list_add(&bo->swap, bdev->driver->swap_lru_tail(bo));
|
|
|
+ }
|
|
|
|
|
|
- man = &bdev->man[bo->mem.mem_type];
|
|
|
- list_move_tail(&bo->lru, &man->lru);
|
|
|
+ list_del(&bo->lru);
|
|
|
+ list_add(&bo->lru, bdev->driver->lru_tail(bo));
|
|
|
}
|
|
|
}
|
|
|
EXPORT_SYMBOL(ttm_bo_move_to_lru_tail);
|
|
|
|
|
|
+struct list_head *ttm_bo_default_lru_tail(struct ttm_buffer_object *bo)
|
|
|
+{
|
|
|
+ return bo->bdev->man[bo->mem.mem_type].lru.prev;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(ttm_bo_default_lru_tail);
|
|
|
+
|
|
|
+struct list_head *ttm_bo_default_swap_lru_tail(struct ttm_buffer_object *bo)
|
|
|
+{
|
|
|
+ return bo->glob->swap_lru.prev;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(ttm_bo_default_swap_lru_tail);
|
|
|
+
|
|
|
/*
|
|
|
* Call bo->mutex locked.
|
|
|
*/
|