[PATCH 1/3] drm/ttm: add ttm_bo_move_to_lru_tail function
Christian König
deathsimple at vodafone.de
Fri Jan 8 01:33:45 PST 2016
Am 05.01.2016 um 22:34 schrieb Alex Deucher:
> On Tue, Jan 5, 2016 at 7:16 AM, Christian König <deathsimple at vodafone.de> wrote:
>> From: Christian König <christian.koenig at amd.com>
>>
>> This allows the drivers to move a BO to the end of the LRU
>> without removing and adding it again.
>>
>> Signed-off-by: Christian König <christian.koenig at amd.com>
>> Reviewed-by: Chunming Zhou <David1.Zhou at amd.com>
> This series is:
> Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
>
> Unless there are any objections to the ttm patch, I'd like to pull
> this series into my drm-next tree.
I have objections!
Ok seriously, David and I have found quite a bug around that in TTM. We
need to fix that before we can push this patch.
Christian.
>
> Alex
>
>> ---
>> drivers/gpu/drm/ttm/ttm_bo.c | 20 ++++++++++++++++++++
>> include/drm/ttm/ttm_bo_api.h | 10 ++++++++++
>> 2 files changed, 30 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
>> index 745e996..9e91cc3 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>> @@ -228,6 +228,26 @@ 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 (!list_empty(&bo->swap)) {
>> + list_del(&bo->swap);
>> + list_add_tail(&bo->swap, &bo->glob->swap_lru);
>> + }
>> +
>> + if (!list_empty(&bo->lru)) {
>> + man = &bdev->man[bo->mem.mem_type];
>> + list_del(&bo->lru);
>> + list_add_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
>> --
>> 2.5.0
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
More information about the dri-devel
mailing list