]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/pagemap: Add a drm_pagemap cache and shrinker
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Fri, 19 Dec 2025 11:33:03 +0000 (12:33 +0100)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Tue, 23 Dec 2025 08:37:33 +0000 (09:37 +0100)
commit77f14f2f2d73f6955b856e7c91ca9fb7046da191
tree6612a0aa4e84b81e9a8b5e6f0dc2fd8f431f2de3
parenta26084328ac40c12096ef01482a7520346379453
drm/pagemap: Add a drm_pagemap cache and shrinker

Pagemaps are costly to set up and tear down, and they consume a lot
of system memory for the struct pages. Ideally they should be
created only when needed.

Add a caching mechanism to allow doing just that: Create the drm_pagemaps
when needed for migration. Keep them around to avoid destruction and
re-creation latencies and destroy inactive/unused drm_pagemaps on memory
pressure using a shrinker.

Only add the helper functions. They will be hooked up to the xe driver
in the upcoming patch.

v2:
- Add lockdep checking for drm_pagemap_put(). (Matt Brost)
- Add a copyright notice. (Matt Brost)

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> # For merging through drm-xe.
Link: https://patch.msgid.link/20251219113320.183860-8-thomas.hellstrom@linux.intel.com
drivers/gpu/drm/Makefile
drivers/gpu/drm/drm_pagemap.c
drivers/gpu/drm/drm_pagemap_util.c [new file with mode: 0644]
include/drm/drm_pagemap.h
include/drm/drm_pagemap_util.h [new file with mode: 0644]