[PATCH 1/5] drm/amdgpu: fix lru size grouping v2

Alex Deucher alexdeucher at gmail.com
Thu Aug 18 22:12:51 UTC 2016


On Thu, Aug 18, 2016 at 5:59 AM, Christian König
<deathsimple at vodafone.de> wrote:
> From: Christian König <christian.koenig at amd.com>
>
> Adding a BO can make it the insertion point for larger sizes as well.
>
> v2: add a comment about the guard structure.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> Acked-by: Alex Deucher <alexander.deucher at amd.com>

Patches 1-4 are:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 2 ++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++++++++
>  2 files changed, 10 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index a55eb6f..b230dd9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -428,6 +428,8 @@ struct amdgpu_mman {
>
>         /* custom LRU management */
>         struct amdgpu_mman_lru                  log2_size[AMDGPU_TTM_LRU_SIZE];
> +       /* guard for log2_size array, don't add anything in between */
> +       struct amdgpu_mman_lru                  guard;
>  };
>
>  int amdgpu_copy_buffer(struct amdgpu_ring *ring,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index f5dc87e..1a12ce0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -951,6 +951,8 @@ static struct list_head *amdgpu_ttm_lru_tail(struct ttm_buffer_object *tbo)
>         struct list_head *res = lru->lru[tbo->mem.mem_type];
>
>         lru->lru[tbo->mem.mem_type] = &tbo->lru;
> +       while ((++lru)->lru[tbo->mem.mem_type] == res)
> +               lru->lru[tbo->mem.mem_type] = &tbo->lru;
>
>         return res;
>  }
> @@ -961,6 +963,8 @@ static struct list_head *amdgpu_ttm_swap_lru_tail(struct ttm_buffer_object *tbo)
>         struct list_head *res = lru->swap_lru;
>
>         lru->swap_lru = &tbo->swap;
> +       while ((++lru)->swap_lru == res)
> +               lru->swap_lru = &tbo->swap;
>
>         return res;
>  }
> @@ -1008,6 +1012,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
>                 lru->swap_lru = &adev->mman.bdev.glob->swap_lru;
>         }
>
> +       for (j = 0; j < TTM_NUM_MEM_TYPES; ++j)
> +               adev->mman.guard.lru[j] = NULL;
> +       adev->mman.guard.swap_lru = NULL;
> +
>         adev->mman.initialized = true;
>         r = ttm_bo_init_mm(&adev->mman.bdev, TTM_PL_VRAM,
>                                 adev->mc.real_vram_size >> PAGE_SHIFT);
> --
> 2.5.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list