[PATCH 7/7] drm/ttm: optimize ttm_mem_evict_first v2
Michel Dänzer
michel at daenzer.net
Thu Nov 9 18:04:39 UTC 2017
On 09/11/17 09:59 AM, Christian König wrote:
> Deleted BOs with the same reservation object can be reaped even if they
> can't be reserved.
>
> v2: rebase and we still need to remove/add the BO from/to the LRU.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
> drivers/gpu/drm/ttm/ttm_bo.c | 39 +++++++++++++++++++++++++++++++--------
> 1 file changed, 31 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 50a678b504f3..6545c4344684 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -735,20 +735,37 @@ bool ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
> EXPORT_SYMBOL(ttm_bo_eviction_valuable);
>
> static int ttm_mem_evict_first(struct ttm_bo_device *bdev,
> - uint32_t mem_type,
> - const struct ttm_place *place,
> - bool interruptible,
> - bool no_wait_gpu)
> + struct reservation_object *resv,
> + uint32_t mem_type,
> + const struct ttm_place *place,
> + bool interruptible,
> + bool no_wait_gpu)
> {
> struct ttm_bo_global *glob = bdev->glob;
> struct ttm_mem_type_manager *man = &bdev->man[mem_type];
> struct ttm_buffer_object *bo;
> int ret = -EBUSY;
> + bool locked;
> unsigned i;
>
> spin_lock(&glob->lru_lock);
> for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) {
> list_for_each_entry(bo, &man->lru[i], lru) {
> + if (bo->resv == resv) {
> + if (list_empty(&bo->ddestroy))
> + continue;
> +
> + if (place &&
> + !bdev->driver->eviction_valuable(bo, place))
> + continue;
> +
> + ttm_bo_del_from_lru(bo);
Is this necessary, despite the existing ttm_bo_del_from_lru call before
unlocking the LRU lock? If yes, why isn't this necessary in the bo->resv
!= resv case?
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
More information about the amd-gfx
mailing list