aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2018-09-13 05:17:23 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-10-10 16:20:54 -0400
commitdf2fc43d09d3ee5ede82cab9299df5e78aa427b5 (patch)
treecb487e12ebde6c70e8877d99871296fe1947c331 /drivers/gpu/drm
parenta553c19d158535a62b513f5a9ef9f036a54b511f (diff)
list: introduce list_bulk_move_tail helper
Move all entries between @first and including @last before @head. This is useful for LRU lists where a whole block of entries should be moved to the end of the list. Used as a band aid in TTM, but better placed in the common list headers. Acked-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Huang Rui <ray.huang@amd.com> Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index b2a33bf1ef10..26b889f86670 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -247,20 +247,6 @@ void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo,
247} 247}
248EXPORT_SYMBOL(ttm_bo_move_to_lru_tail); 248EXPORT_SYMBOL(ttm_bo_move_to_lru_tail);
249 249
250static void ttm_list_move_bulk_tail(struct list_head *list,
251 struct list_head *first,
252 struct list_head *last)
253{
254 first->prev->next = last->next;
255 last->next->prev = first->prev;
256
257 list->prev->next = first;
258 first->prev = list->prev;
259
260 last->next = list;
261 list->prev = last;
262}
263
264void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move *bulk) 250void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move *bulk)
265{ 251{
266 unsigned i; 252 unsigned i;
@@ -276,8 +262,8 @@ void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move *bulk)
276 reservation_object_assert_held(pos->last->resv); 262 reservation_object_assert_held(pos->last->resv);
277 263
278 man = &pos->first->bdev->man[TTM_PL_TT]; 264 man = &pos->first->bdev->man[TTM_PL_TT];
279 ttm_list_move_bulk_tail(&man->lru[i], &pos->first->lru, 265 list_bulk_move_tail(&man->lru[i], &pos->first->lru,
280 &pos->last->lru); 266 &pos->last->lru);
281 } 267 }
282 268
283 for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) { 269 for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) {
@@ -291,8 +277,8 @@ void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move *bulk)
291 reservation_object_assert_held(pos->last->resv); 277 reservation_object_assert_held(pos->last->resv);
292 278
293 man = &pos->first->bdev->man[TTM_PL_VRAM]; 279 man = &pos->first->bdev->man[TTM_PL_VRAM];
294 ttm_list_move_bulk_tail(&man->lru[i], &pos->first->lru, 280 list_bulk_move_tail(&man->lru[i], &pos->first->lru,
295 &pos->last->lru); 281 &pos->last->lru);
296 } 282 }
297 283
298 for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) { 284 for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) {
@@ -306,8 +292,7 @@ void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move *bulk)
306 reservation_object_assert_held(pos->last->resv); 292 reservation_object_assert_held(pos->last->resv);
307 293
308 lru = &pos->first->bdev->glob->swap_lru[i]; 294 lru = &pos->first->bdev->glob->swap_lru[i];
309 ttm_list_move_bulk_tail(lru, &pos->first->swap, 295 list_bulk_move_tail(lru, &pos->first->swap, &pos->last->swap);
310 &pos->last->swap);
311 } 296 }
312} 297}
313EXPORT_SYMBOL(ttm_bo_bulk_move_lru_tail); 298EXPORT_SYMBOL(ttm_bo_bulk_move_lru_tail);