Memory eviction in ttm

Maarten Lankhorst maarten.lankhorst at canonical.com
Wed Sep 12 08:27:53 PDT 2012


Op 12-09-12 15:28, Thomas Hellstrom schreef:
> On 09/12/2012 02:48 PM, Maarten Lankhorst wrote:
>> Hey Thomas,
>>
>> I'm playing around with moving reservations from ttm to global, but how ttm
>> ttm is handling reservations is getting in the way.  The code wants to move
>> the bo from the lru lock at the same time a reservation is made, but that
>> seems to be slightly too strict. It would really help me if that guarantee
>> is removed.
> Hi, Maarten.
>
> Removing that restriction is not really possible at the moment.
> Also the memory accounting code depends on this, and may cause reservations
> in the most awkward places. Since these reservations don't have a ticket
> they may and will cause deadlocks. So in short the restriction is there
> to avoid deadlocks caused by ticketless reservations.
Yeah I was afraid of that, however with some buffers no longer managed by ttm
it will be impossible to guarantee that buffers are not reserved while on the lru list.

I've been working on adding some lockdep state to the generic reservations
code. It was already complaining about lru_lock, so hopefully if there is any
potential for reservation deadlock, lockdep will throw big scary errors at you.

If the guarantee that all buffers on the lru list can be reserved can be removed,
it would also be a step forward to make dma-buf buffers evictable.

>> Is it true that only the ttm_mem_evict code depends on it? And in that case
>> wouldn't it be better to attempt to free any buffer that can be reserved
>> without blocking first, instead of blocking on the first entry in the list?
> Normally there is no reservation blocking, since the items on the LRU lists
> are guaranteed not to be reserved, but if we reserve without taking off
> LRU lists, the above may be a good optimization.
..?

~Maarten



More information about the dri-devel mailing list