rdmacg_try_charge(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 your rdmacg device. 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 πŸ‘‘

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