STRUCT TTM_RESOURCE_MANAGER(9)
π struct ttm_resource_manager(9)
okay so this is a page from the Kernel API Manual bestie, and it's literally all about struct ttm_resource_manager β the lil' main character that keeps track of memory types for a device. no cap, it's giving "backstage manager of the whole memory vibe." let's get into it π
β¨ SYNOPSIS β¨
struct ttm_resource_manager {
bool use_type;
bool use_tt;
struct ttm_device *bdev;
uint64_t size;
const struct ttm_resource_manager_func *func;
spinlock_t eviction_lock;
struct dma_fence *eviction_fences[TTM_NUM_MOVE_FENCES];
struct list_head lru[TTM_MAX_BO_PRIORITY];
uint64_t usage;
struct dmem_cgroup_region *cg;
};
πΈ Members πΈ
use_typeβ this bool is the vibe check for the memory type: it's enabled or it's not, periodt. β¨use_ttβ says whether a TT object should be the backing store for this thing. iykyk.bdevβ the ttm device that this manager belongs to π«Ά (its home base, fr fr).sizeβ how big the managed region is. the actual size. the whole thing πfuncβ a structure pointer implementing the range manager. see above, bestie πeviction_lockβ the lock for eviction fences π literally its whole job.eviction_fencesβ the fences of the last pipelined move operation. yes, all of them, it's an array:eviction_fences[TTM_NUM_MOVE_FENCES]π¦lruβ the lru list for this memory type, and it's an array too:lru[TTM_MAX_BO_PRIORITY]πusageβ how much of the resources are used. important caveat: this is protected bybdev->lru_lockπ₯ don't be out here reading it unprotected, that's not the move πcgβ thedmem_cgroup_regionused for memory accounting, if it's notNULL. if it isNULL, bestie, there's no accounting happening π
β Description β
so like, this structure is used to identify and manage memory types for a device β¨ that's it, that's the whole glow-up. it's the organizational queen of the memory types π
π¦ SEE ALSO π¦
kernel file ./include/drm/ttm/ttm_resource.h and honestly this whole friend group:
TTM_NUM_MOVE_FENCES(9)enum ttm_lru_item_type(9)struct ttm_lru_item(9)ttm_lru_item_init(9)struct ttm_bus_placement(9)struct ttm_resource(9)ttm_lru_item_to_res(9)struct ttm_lru_bulk_move_pos(9)struct ttm_lru_bulk_move(9)struct ttm_resource_cursor(9)struct ttm_kmap_iter_iomap(9)struct ttm_kmap_iter_linear_io(9)ttm_resource_manager_set_used(9)ttm_resource_manager_used(9)ttm_resource_manager_cleanup(9)ttm_resource_manager_for_each_res(9)
and that's the whole page!! π§ from ./include/drm/ttm, dated October 2026 β mwah, slay, go read the source header if you want more ππ
π¦ 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