[PATCH v20 09/10] drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin

Dmitry Osipenko dmitry.osipenko at collabora.com
Wed Apr 2 12:58:55 UTC 2025


On 4/2/25 15:47, Thomas Zimmermann wrote:
> Hi
> 
> Am 22.03.25 um 22:26 schrieb Dmitry Osipenko:
>> The vmapped pages shall be pinned in memory and previously get/
>> put_pages()
>> were implicitly hard-pinning/unpinning the pages. This will no longer be
>> the case with addition of memory shrinker because pages_use_count > 0
>> won't
>> determine anymore whether pages are hard-pinned (they will be soft-
>> pinned),
>> while the new pages_pin_count will do the hard-pinning. Switch the
>> vmap/vunmap() to use pin/unpin() functions in a preparation of addition
>> of the memory shrinker support to drm-shmem.
> 
> I've meanwhile rediscovered this patch and I'm sure this is not correct.
> Vmap should not pin AFAIK. It is possible to vmap if the buffer has been
> pinned, but that's not automatic.  For other vmaps it is necessary to
> hold the reservation lock to prevent the buffer from moving.

Hi, with vmap() you're getting a kernel address. The GEM's memory should
be not movable while it's vmapped as we can't handle kernel page faults.

Not sure what you're meaning by the "other vmaps", please clarify.

-- 
Best regards,
Dmitry


More information about the dri-devel mailing list