Re: [PATCH v2 6/8] drm/shmem-helper: Add generic memory shrinker

From: Dmitry Osipenko
Date: Wed Mar 16 2022 - 19:04:05 EST


On 3/16/22 18:04, Steven Price wrote:
> On 14/03/2022 22:42, Dmitry Osipenko wrote:
>> Introduce a common DRM SHMEM shrinker. It allows to reduce code
>> duplication among DRM drivers, it also handles complicated lockings
>> for the drivers. This is initial version of the shrinker that covers
>> basic needs of GPU drivers.
>>
>> This patch is based on a couple ideas borrowed from Rob's Clark MSM
>> shrinker and Thomas' Zimmermann variant of SHMEM shrinker.
>>
>> GPU drivers that want to use generic DRM memory shrinker must support
>> generic GEM reservations.
>>
>> Signed-off-by: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>
>> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@xxxxxxxxxxxxx>
> This looks fine to me, but one nitpick: you should update the comment in
> struct drm_gem_shmem_object:
>
>> /**
>> * @madv: State for madvise
>> *
>> * 0 is active/inuse.
>> * A negative value is the object is purged.
>> * Positive values are driver specific and not used by the helpers.
>> */
>> int madv;
> This is adding a helper which cares about the positive values.

Good catch, I'll update the comment in v3.