diff options
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 25 | ||||
-rw-r--r-- | include/linux/list.h | 23 |
2 files changed, 28 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 | } |
248 | EXPORT_SYMBOL(ttm_bo_move_to_lru_tail); | 248 | EXPORT_SYMBOL(ttm_bo_move_to_lru_tail); |
249 | 249 | ||
250 | static 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 | |||
264 | void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move *bulk) | 250 | void 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 | } |
313 | EXPORT_SYMBOL(ttm_bo_bulk_move_lru_tail); | 298 | EXPORT_SYMBOL(ttm_bo_bulk_move_lru_tail); |
diff --git a/include/linux/list.h b/include/linux/list.h index de04cc5ed536..edb7628e46ed 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
@@ -184,6 +184,29 @@ static inline void list_move_tail(struct list_head *list, | |||
184 | } | 184 | } |
185 | 185 | ||
186 | /** | 186 | /** |
187 | * list_bulk_move_tail - move a subsection of a list to its tail | ||
188 | * @head: the head that will follow our entry | ||
189 | * @first: first entry to move | ||
190 | * @last: last entry to move, can be the same as first | ||
191 | * | ||
192 | * Move all entries between @first and including @last before @head. | ||
193 | * All three entries must belong to the same linked list. | ||
194 | */ | ||
195 | static inline void list_bulk_move_tail(struct list_head *head, | ||
196 | struct list_head *first, | ||
197 | struct list_head *last) | ||
198 | { | ||
199 | first->prev->next = last->next; | ||
200 | last->next->prev = first->prev; | ||
201 | |||
202 | head->prev->next = first; | ||
203 | first->prev = head->prev; | ||
204 | |||
205 | last->next = head; | ||
206 | head->prev = last; | ||
207 | } | ||
208 | |||
209 | /** | ||
187 | * list_is_last - tests whether @list is the last entry in list @head | 210 | * list_is_last - tests whether @list is the last entry in list @head |
188 | * @list: the entry to test | 211 | * @list: the entry to test |
189 | * @head: the head of the list | 212 | * @head: the head of the list |