Re: [PATCH] drm/ttm: Make NO_EVICT bos available to shrinkers pending destruction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 10, 2013 at 8:22 PM, Thomas Hellstrom <thellstrom@xxxxxxxxxx> wrote:
> NO_EVICT bos that are not idle when all references are dropped are put on
> the delayed destroy list. However, since they are not on LRU lists, they
> are not available to shrinkers at that point, and buffers on the delayed
> destroy list are not checked very often for idle.
>
> So when these buffers are put on the delayed destroy list, clear the
> NO_EVICT flag and put them on the right LRU list. This way they are
> immediately available for eviction or shrinkers and will not cause false
> OOMS.
>
> Signed-off-by: Thomas Hellstrom <thellstrom@xxxxxxxxxx>

Reviewed-by: Jakob Bornecrantz <jakob@xxxxxxxxxx>

> ---
>  drivers/gpu/drm/ttm/ttm_bo.c |   14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index f1a857e..6c1a38f 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -429,8 +429,20 @@ static void ttm_bo_cleanup_refs_or_queue(struct ttm_buffer_object *bo)
>                 sync_obj = driver->sync_obj_ref(bo->sync_obj);
>         spin_unlock(&bdev->fence_lock);
>
> -       if (!ret)
> +       if (!ret) {
> +
> +               /*
> +                * Make NO_EVICT bos immediately available to
> +                * shrinkers, now that they are queued for
> +                * destruction.
> +                */
> +               if (bo->mem.placement & TTM_PL_FLAG_NO_EVICT) {
> +                       bo->mem.placement &= ~TTM_PL_FLAG_NO_EVICT;
> +                       ttm_bo_add_to_lru(bo);
> +               }
> +
>                 ww_mutex_unlock(&bo->resv->lock);
> +       }
>
>         kref_get(&bo->list_kref);
>         list_add_tail(&bo->ddestroy, &bdev->ddestroy);
> --
> 1.7.10.4
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux