rdmacg_try_charge(9)
π rdmacg_try_charge β the kernel API manual, bestie edition β¨
okay so bestie, we're looking at the kernel API manual page for rdmacg_try_charge, and honestly? it's giving resource-accounting main character energy. let's get into it π
πΈ NAME πΈ
rdmacg_try_charge β hierarchically try to charge the rdma resource. that's it, that's the vibe. it tries to charge. hierarchically. periodt π
β¨ SYNOPSIS β¨
int rdmacg_try_charge (struct rdma_cgroup **rdmacg , struct
rdmacg_device *device , enum rdmacg_resource_type index );
look at that signature. so clean. so iconic. three args, one int coming back at you π«Ά
π¦ ARGUMENTS π¦
rdmacgβ pointer to the rdma cgroup that's gonna own this resource. like, it's literally the new parent of your charge, no cap πdeviceβ pointer to yourrdmacgdevice. the device in question. the one doing the thing πindexβ index of the resource you wanna charge inside the cgroup (the resource pool, iykyk) β
π₯ DESCRIPTION π₯
so here's the tea, bestie. this function follows the charging of a resource in a hierarchical way. it will fail if the charge would cause the new value to exceed the hierarchical limit β like, it's not gonna let you blow past the ceiling, that's not the move π
it returns 0 if the charge succeeded; otherwise it gives you -EAGAIN, -ENOMEM, or -EINVAL. and when charging is successful, it returns a pointer to rdmacg for this resource. cute, right? β¨
now, the charger needs to account resources on two criteria, and yes you have to care about both:
- (a) per cgroup β the per-cgroup resource usage makes sure that tasks of the cgroup don't cross the configured limits π§
- (b) per device β resource usage. per device gives you granular configuration in multi-device usage, which is honestly highkey useful π
it allocates a resource pool in the hierarchy for each parent it comes across, for the first resource. later on, that resource pool will be available β so it's gonna be much faster thereupon to charge/uncharge. the way that it just caches and slays ππ
ngl, the first pass is the expensive one. after that? smooth sailing, bestie. don't @ me, that's literally what the manpage says π
π SEE ALSO π
- Kernel file
./kernel/cgroup/rdma.c uncharge_cg_locked(9)rdmacg_event_locked(9)rdmacg_uncharge_hierarchy(9)rdmacg_uncharge(9)rdmacg_register_device(9)rdmacg_unregister_device(9)rdmacg_css_offline(9)
go read those too, bestie, they're all in the group chat π§
and that's the whole page! π this lil beauty lives under ./kernel/cgroup and it's dated October 2026, all under the rdmacg_try_charge(9) banner. mwah, go charge some rdma resources 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