[PATCH 4/6] drm/radeon: add buffers to the LRU list from smallest to largest
Michel Dänzer
michel at daenzer.net
Wed Feb 26 17:22:37 PST 2014
On Mit, 2014-02-26 at 19:25 +0100, Marek Olšák wrote:
>
> diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
> index f28a8d8..d49a3f7 100644
> --- a/drivers/gpu/drm/radeon/radeon_cs.c
> +++ b/drivers/gpu/drm/radeon/radeon_cs.c
> [...]
> @@ -303,6 +314,18 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo
> unsigned i;
>
> if (!error) {
> + /* Sort the buffer list from the smallest to largest buffer,
> + * which affects the order of buffers in the LRU list.
> + * This assures that the smallest buffers are added first
> + * to the LRU list, so they are likely to be later evicted
> + * first, instead of large buffers whose eviction is more
> + * expensive.
> + *
> + * This slightly lowers the number of bytes moved by TTM
> + * per frame under memory pressure.
> + */
> + list_sort(NULL, &parser->validated, cmp_size_smaller_first);
> +
> ttm_eu_fence_buffer_objects(&parser->ticket,
> &parser->validated,
> parser->ib.fence);
This seems like a good idea in general, so maybe it should be done in
ttm_eu_fence_buffer_objects() instead, and possibly also in the callers
of ttm_eu_backoff_reservation_locked().
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
More information about the dri-devel
mailing list