ttm_resource_try_charge(9)
π ttm_resource_try_charge(9) π
okay so bestie, welcome to the Kernel API Manual β this one's called ttm_resource_try_charge, and it's literally the bouncer at the door of the resource manager's cgroup pool π
β¨ SYNOPSIS β¨
int ttm_resource_try_charge (struct ttm_buffer_object *bo , const struct
ttm_place *place , struct dmem_cgroup_pool_state **ret_pool , struct
dmem_cgroup_pool_state **ret_limit_pool );
like yes, it's four args, no we're not scared of it πͺ
πΈ ARGUMENTS πΈ
boβ the buffer that's getting its allocation charged, i.e. the main character of this whole operation πplaceβ where we're attempting to put the allocation, the vibe check location if u willret_poolβ on charge success, this is the pool that got charged. icon. ate. no crumbs πret_limit_poolβ on charge failure, this is the pool that's responsible for the failure. snitch behavior but make it useful π
π¦ DESCRIPTION π¦
okay so here's the tea: you should use this to charge cgroups before attempting resource allocation. like, before. not after. before. periodt π
when the charging succeeds, the value of ret_pool should be passed to ttm_resource_alloc. that's it, that's the handoff, pass the pool along like a note in class bestie π«Ά
β RETURN β
0on charge success π- negative
errnoon failure π
π₯ SEE ALSO π₯
Kernel file ./drivers/gpu/drm/ttm/ttm_resource.c
and the whole friend group, in order:
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_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)ttm_resource_manager_set_dmem_region(9)
and that's the whole page babes π this came at you from ./drivers/gpu/drm/ttm, dated October 2026 β mwah, go charge those cgroups responsibly π§β¨
π¦ 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