From: Thomas Hellstrom <thellstrom@vmware.com>
To: "Marek Olšák" <maraeo@gmail.com>
Cc: "Michel Dänzer" <michel@daenzer.net>,
dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 4/6] drm/radeon: add buffers to the LRU list from smallest to largest
Date: Tue, 04 Mar 2014 14:27:31 +0100 [thread overview]
Message-ID: <5315D4C3.6020107@vmware.com> (raw)
In-Reply-To: <CAAxE2A7Bmnp5L5zr72h6RUWrOj52Q=d4znqkH2Ti1-xvyTX1sw@mail.gmail.com>
Hi, Marek!
I'm OOTO this week, so I can't take a closer look until next week but
there are a couple of things that worries me about this.
1) It's optimizing a slowpath (memory pressure) at the cost of making a
fastpath slower by adding a sorting pass.
2) While it might make a difference on VRAM, it will not help much on
fragmentation-free memory types, like vmwgfx GMR and MOB memory types.
3) It seems like the mechanism by which it works is to reduce the amount
of memory evicted "in vain", (buffers that do not contribute to the
final free memory area that's used). If that's really the case, there
are better ways to do this (walk the LRU list pre-determining what
buffers need to be evicted like the intel driver does).
So considering this, I think we should make this sorting pass optional.
/Thomas
On 03/01/2014 10:57 PM, Marek Olšák wrote:
> Only the VMWare driver uses ttm_eu_fence_buffer_objects. Cc'ing
> Thomas. What do you think about this, Thomas?
>
> Marek
>
> On Thu, Feb 27, 2014 at 2:22 AM, Michel Dänzer <michel@daenzer.net> wrote:
>> 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 | https://urldefense.proofpoint.com/v1/url?u=http://www.amd.com/&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=l5Ago9ekmVFZ3c4M6eauqrJWGwjf6fTb%2BP3CxbBFkVM%3D%0A&m=aQIiktj8ewwEsYip5R%2FcVgKb30vgbPORPhMChqLpKg0%3D%0A&s=ccc52fd17cadd5c2a056880e0fc457d6e7258e119ac5fc4545a0aea4b4a0aa34
>> Libre software enthusiast | Mesa and X developer
>>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2014-03-04 13:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-26 18:25 [PATCH 1/6] drm/radeon: add a way to get and set initial buffer domains Marek Olšák
2014-02-26 18:25 ` [PATCH 2/6] drm/radeon: track memory statistics about VRAM and GTT usage and buffer moves Marek Olšák
2014-02-26 18:25 ` [PATCH 3/6] drm/radeon: deduplicate code in radeon_gem_busy_ioctl Marek Olšák
2014-02-26 18:25 ` [PATCH 4/6] drm/radeon: add buffers to the LRU list from smallest to largest Marek Olšák
2014-02-27 1:22 ` Michel Dänzer
2014-03-01 21:57 ` Marek Olšák
2014-03-04 13:27 ` Thomas Hellstrom [this message]
2014-02-26 18:25 ` [PATCH 5/6] drm/radeon: validate relocations in the order determined by userspace Marek Olšák
2014-02-27 9:29 ` Christian König
2014-02-26 18:25 ` [PATCH 6/6] drm/radeon: limit how much memory TTM can move per IB according to VRAM usage Marek Olšák
-- strict thread matches above, loose matches on Subject: below --
2014-03-01 23:56 [PATCH 0/6] Radeon memory management improvements v3 Marek Olšák
2014-03-01 23:56 ` [PATCH 4/6] drm/radeon: add buffers to the LRU list from smallest to largest Marek Olšák
2014-02-24 15:20 [PATCH 0/6] Radeon memory management improvements Marek Olšák
2014-02-24 15:20 ` [PATCH 4/6] drm/radeon: add buffers to the LRU list from smallest to largest Marek Olšák
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=5315D4C3.6020107@vmware.com \
--to=thellstrom@vmware.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=maraeo@gmail.com \
--cc=michel@daenzer.net \
/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.