Skip to content

Commit dfe6aa1

Browse files
Maarten Lankhorstmripard
authored andcommitted
drm/xe: Implement cgroup for vram
Add vram based cgroup eviction to Xe. Most hardware with VRAM uses TTM for its management, and can be similarly trivially enabled. Co-developed-by: Maxime Ripard <[email protected]> Signed-off-by: Maarten Lankhorst <[email protected]> Acked-by: Rodrigo Vivi <[email protected]> Acked-by: Tejun Heo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Maxime Ripard <[email protected]>
1 parent 2b624a2 commit dfe6aa1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/gpu/drm/xe/xe_ttm_vram_mgr.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
#include <drm/drm_managed.h>
8+
#include <drm/drm_drv.h>
89

910
#include <drm/ttm/ttm_placement.h>
1011
#include <drm/ttm/ttm_range_manager.h>
@@ -339,6 +340,13 @@ int __xe_ttm_vram_mgr_init(struct xe_device *xe, struct xe_ttm_vram_mgr *mgr,
339340
struct ttm_resource_manager *man = &mgr->manager;
340341
int err;
341342

343+
if (mem_type != XE_PL_STOLEN) {
344+
const char *name = mem_type == XE_PL_VRAM0 ? "vram0" : "vram1";
345+
man->cg = drmm_cgroup_register_region(&xe->drm, name, size);
346+
if (IS_ERR(man->cg))
347+
return PTR_ERR(man->cg);
348+
}
349+
342350
man->func = &xe_ttm_vram_mgr_func;
343351
mgr->mem_type = mem_type;
344352
mutex_init(&mgr->lock);

0 commit comments

Comments
 (0)