mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin
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. Acked-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Acked-by: Thomas Zimmermann <tzimmermann@suse.d> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250322212608.40511-10-dmitry.osipenko@collabora.com
This commit is contained in:
@@ -360,7 +360,7 @@ int drm_gem_shmem_vmap_locked(struct drm_gem_shmem_object *shmem,
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = drm_gem_shmem_get_pages_locked(shmem);
|
||||
ret = drm_gem_shmem_pin_locked(shmem);
|
||||
if (ret)
|
||||
goto err_zero_use;
|
||||
|
||||
@@ -383,7 +383,7 @@ int drm_gem_shmem_vmap_locked(struct drm_gem_shmem_object *shmem,
|
||||
|
||||
err_put_pages:
|
||||
if (!drm_gem_is_imported(obj))
|
||||
drm_gem_shmem_put_pages_locked(shmem);
|
||||
drm_gem_shmem_unpin_locked(shmem);
|
||||
err_zero_use:
|
||||
shmem->vmap_use_count = 0;
|
||||
|
||||
@@ -420,7 +420,7 @@ void drm_gem_shmem_vunmap_locked(struct drm_gem_shmem_object *shmem,
|
||||
return;
|
||||
|
||||
vunmap(shmem->vaddr);
|
||||
drm_gem_shmem_put_pages_locked(shmem);
|
||||
drm_gem_shmem_unpin_locked(shmem);
|
||||
}
|
||||
|
||||
shmem->vaddr = NULL;
|
||||
|
||||
Reference in New Issue
Block a user