ttm_resource..._dmem_region(9)
π ttm_resource_manager_set_dmem_region β Kernel API Manual π
okay so bestie, you're looking at ttm_resource..._dmem_region(9), and literally it's one tiny function that does one tiny thing, but it's important, so let's get into it π«Ά
β¨ NAME β¨
ttm_resource_manager_set_dmem_region β Associate a dmem cgroup region with a resource manager. that's it. that's the whole vibe π
πΈ SYNOPSIS πΈ
void ttm_resource_manager_set_dmem_region (struct ttm_resource_manager
*man , struct dmem_cgroup_region *region );
no return value, no drama, void and iconic π
π¦ ARGUMENTS π¦
manβ The resource manager. the main character of this whole operation πregionβ The dmem cgroup region to associate. and listen, it may beNULLorIS_ERRβ both are legal, don't panic π
π₯ DESCRIPTION π₯
okay so here's the tea β β this function is basically a matchmaker for your resource manager and a cgroup region, and what it does depends on what you hand it:
- When
regionis valid, it stores it inman->cgso that TTM can look up the associated pool during charging and eviction-target selection. so like, TTM needs to know who its people are when it's doing the charging and picking eviction targets, and now it does π - When
regionisNULL, it clearsman->cgto detach the region before teardown. breakup era, but make it graceful π - An
IS_ERRregion is ignored, leavingman->cgunchanged. like, that's not a real region bestie, we're not touching anything, nothing happens, periodt π
β οΈ also super important, ngl: the reclaim callback must be wired up usingttm_resource_manager_dmem_reclaimin the driver's ownstruct dmem_cgroup_ops, with the manager pointer asinit.reclaim_priv. do not skip this step, it's giving "required homework" not "optional side quest" π
β SEE ALSO β
Kernel file ./drivers/gpu/drm/ttm/ttm_resource.c
and the whole friend group π«Ά:
ttm_resource_cursor_init(9)ttm_resource_cursor_fini(9)ttm_lru_bulk_move_init(9)ttm_lru_bulk_move_fini(9)ttm_lru_bulk_move_tail(9)ttm_resource_init(9)ttm_resource_fini(9)ttm_resource_try_charge(9)ttm_resource_intersects(9)ttm_resource_compatible(9)ttm_resource_manager_init(9)ttm_resource_manager_usage(9)ttm_resource_manager_debug(9)ttm_resource_manager_first(9)ttm_resource_manager_next(9)ttm_lru_first_res_or_null(9)ttm_kmap_iter_iomap_init(9)Linear io iterator(9)ttm_kmap_iter_linear_io_init(9)ttm_kmap_iter_linear_io_fini(9)ttm_resource_manager_create_debugfs(9)ttm_resource_manager_dmem_reclaim(9)
and that's the whole page, bestie π this little gem lives over in ./drivers/gpu/drm/ttm and it was dated October 2026 β go off, ttm_resource..._dmem_region(9) you ate π
β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms