[PATCH v6 17/22] drm/shmem-helper: Add generic memory shrinker
Dmitry Osipenko
dmitry.osipenko at collabora.com
Tue Jun 7 15:33:55 UTC 2022
On 6/6/22 13:57, Christian König wrote:
> Am 05.06.22 um 18:47 schrieb Daniel Vetter:
>> On Fri, 27 May 2022 at 01:55, Dmitry Osipenko
>> <dmitry.osipenko at collabora.com> wrote:
>>> Introduce a common DRM SHMEM shrinker framework that allows to reduce
>>> code duplication among DRM drivers by replacing theirs custom shrinker
>>> implementations with the generic shrinker.
>>>
>>> In order to start using DRM SHMEM shrinker drivers should:
>>>
>>> 1. Implement new evict() shmem object callback.
>>> 2. Register shrinker using drm_gem_shmem_shrinker_register(drm_device).
>>> 3. Use drm_gem_shmem_set_purgeable(shmem) and alike API functions to
>>> activate shrinking of shmem GEMs.
>>>
>>> This patch is based on a ideas borrowed from Rob's Clark MSM shrinker,
>>> Thomas' Zimmermann variant of SHMEM shrinker and Intel's i915 shrinker.
>>>
>>> Signed-off-by: Daniel Almeida <daniel.almeida at collabora.com>
>>> Signed-off-by: Dmitry Osipenko <dmitry.osipenko at collabora.com>
>> So I guess I get a price for being blind since forever, because this
>> thing existed since at least 2013. I just stumbled over
>> llist_lru.[hc], a purpose built list helper for shrinkers. I think we
>> should try to adopt that so that our gpu shrinkers look more like
>> shrinkers for everything else.
>
> What the heck are you talking about?
>
> I can't find any llist_lru.[hc] in the linux kernel sources.
I think Daniel meant this:
https://elixir.bootlin.com/linux/v5.19-rc1/source/include/linux/list_lru.h
https://elixir.bootlin.com/linux/v5.19-rc1/source/mm/list_lru.c
--
Best regards,
Dmitry
More information about the amd-gfx
mailing list