All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Hellstrom <thomas@shipmail.org>
To: "Christian König" <deathsimple@vodafone.de>, alexdeucher@gmail.com
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/5] drm/ttm: add ttm_bo_move_to_lru_tail function v2
Date: Mon, 11 Jan 2016 16:29:39 +0100	[thread overview]
Message-ID: <5693CA63.5090502@shipmail.org> (raw)
In-Reply-To: <1452522922-2614-3-git-send-email-deathsimple@vodafone.de>

LGTM,

Although perhaps check that the LRU lock is held as well.

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>

On 01/11/2016 03:35 PM, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
>
> This allows the drivers to move a BO to the end of the LRU
> without removing and adding it again.
>
> v2: Make it more robust, handle pinned and swapable BOs as well.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/ttm/ttm_bo.c | 21 +++++++++++++++++++++
>  include/drm/ttm/ttm_bo_api.h | 10 ++++++++++
>  2 files changed, 31 insertions(+)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 3ea9a01..4cbf265 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -228,6 +228,27 @@ void ttm_bo_del_sub_from_lru(struct ttm_buffer_object *bo)
>  }
>  EXPORT_SYMBOL(ttm_bo_del_sub_from_lru);
>  
> +void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo)
> +{
> +	struct ttm_bo_device *bdev = bo->bdev;
> +	struct ttm_mem_type_manager *man;
> +
> +	lockdep_assert_held(&bo->resv->lock.base);
> +
> +	if (bo->mem.placement & TTM_PL_FLAG_NO_EVICT) {
> +		list_del_init(&bo->swap);
> +		list_del_init(&bo->lru);
> +
> +	} else {
> +		if (bo->ttm && !(bo->ttm->page_flags & TTM_PAGE_FLAG_SG))
> +			list_move_tail(&bo->swap, &bo->glob->swap_lru);
> +
> +		man = &bdev->man[bo->mem.mem_type];
> +		list_move_tail(&bo->lru, &man->lru);
> +	}
> +}
> +EXPORT_SYMBOL(ttm_bo_move_to_lru_tail);
> +
>  /*
>   * Call bo->mutex locked.
>   */
> diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
> index c768ddf..afae231 100644
> --- a/include/drm/ttm/ttm_bo_api.h
> +++ b/include/drm/ttm/ttm_bo_api.h
> @@ -383,6 +383,16 @@ extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo);
>   */
>  extern int ttm_bo_del_from_lru(struct ttm_buffer_object *bo);
>  
> +/**
> + * ttm_bo_move_to_lru_tail
> + *
> + * @bo: The buffer object.
> + *
> + * Move this BO to the tail of all lru lists used to lookup and reserve an
> + * object. This function must be called with struct ttm_bo_global::lru_lock
> + * held, and is used to make a BO less likely to be considered for eviction.
> + */
> +extern void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo);
>  
>  /**
>   * ttm_bo_lock_delayed_workqueue


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-01-11 15:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11 14:35 [PATCH 1/5] drm/ttm: fix adding foreign BOs to the LRU during init v2 Christian König
2016-01-11 14:35 ` [PATCH 2/5] drm/ttm: fix adding foreign BOs to the swap LRU Christian König
2016-01-11 15:14   ` Thomas Hellstrom
2016-01-11 14:35 ` [PATCH 3/5] drm/ttm: add ttm_bo_move_to_lru_tail function v2 Christian König
2016-01-11 15:29   ` Thomas Hellstrom [this message]
2016-01-11 14:35 ` [PATCH 4/5] drm/amdgpu: move VM page tables to the LRU end on CS v2 Christian König
2016-01-11 14:35 ` [PATCH 5/5] drm/amdgpu: validate duplicates first Christian König
2016-01-13 17:23   ` Alex Deucher
2016-01-11 15:06 ` [PATCH 1/5] drm/ttm: fix adding foreign BOs to the LRU during init v2 Thomas Hellstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5693CA63.5090502@shipmail.org \
    --to=thomas@shipmail.org \
    --cc=alexdeucher@gmail.com \
    --cc=deathsimple@vodafone.de \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.