[PATCH 1/3] drm/ttm: fix ttm_bo_bulk_move_helper

Zhang, Jerry (Junwei) Jerry.Zhang at amd.com
Mon Sep 3 02:05:25 UTC 2018


On 08/31/2018 09:10 PM, Christian König wrote:
> Staring at the function for six hours, just to essentially move one line
> of code.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang at amd.com>

> ---
>   drivers/gpu/drm/ttm/ttm_bo.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 35d53d81f486..138c98902033 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -250,15 +250,18 @@ EXPORT_SYMBOL(ttm_bo_move_to_lru_tail);
>   static void ttm_bo_bulk_move_helper(struct ttm_lru_bulk_move_pos *pos,
>   				    struct list_head *lru, bool is_swap)
>   {
> +	struct list_head *list;
>   	LIST_HEAD(entries);
>   	LIST_HEAD(before);
> -	struct list_head *list1, *list2;
>
> -	list1 = is_swap ? &pos->last->swap : &pos->last->lru;
> -	list2 = is_swap ? pos->first->swap.prev : pos->first->lru.prev;
> +	reservation_object_assert_held(pos->last->resv);
> +	list = is_swap ? &pos->last->swap : &pos->last->lru;
> +	list_cut_position(&entries, lru, list);
> +
> +	reservation_object_assert_held(pos->first->resv);
> +	list = is_swap ? pos->first->swap.prev : pos->first->lru.prev;
> +	list_cut_position(&before, &entries, list);
>
> -	list_cut_position(&entries, lru, list1);
> -	list_cut_position(&before, &entries, list2);
>   	list_splice(&before, lru);
>   	list_splice_tail(&entries, lru);
>   }
>


More information about the amd-gfx mailing list