[PATCH v1 0/5] Add memory shrinker to VirtIO-GPU DRM driver
Dmitry Osipenko
dmitry.osipenko at collabora.com
Thu Mar 10 21:32:37 UTC 2022
On 3/10/22 22:02, Thomas Zimmermann wrote:
> Hi
>
> Am 09.03.22 um 23:25 schrieb Dmitry Osipenko:
>>>
>>> The reason for this work is to keep GEM shmem pages mapped and allocated
>>> even while the BO is neither mapped nor pinned. As it is now, GEM SHMEM
>>> creates and releases pages on each pin and unpin, and maps and unmaps
>>> memory ranges on each vmap and vunmap. It's all wasteful. Only the
>>> first pin and vmap calls should establish pages and mappings and only
>>> the purge and free functions should release them.
>>
>> Hm, aren't maps and pins already refcounted?
>
> They are. But even when the refcounter reaches 0 on deref, there's no
> need to remove the mapping or free the memory pages. We can keep them
> around for the next ref operation. Only the shrinker's purge or freeing
> the object has to do such clean-up operations. Such behavior is
> supported by TTM and we already use it in VRAM helpers as well.
When driver won't want to pin BO at the creation time? Looks like all
shmem users do this today, and thus, pages shouldn't be freed until BO
is destroyed or purged.
More information about the dri-devel
mailing list