hfi1_free_ctxt(9)
π hfi1_free_ctxt(9) β the Kernel API Manual, bestie edition π
Okay so we're in the kernel API manual today, and the star of the show is hfi1_free_ctxt(9). Buckle up, this one's a little one but she matters β¨
πΈ NAME πΈ
hfi1_free_ctxt β free context. That's it. That's the whole vibe. She frees the context π
β¨ SYNOPSIS β¨
void hfi1_free_ctxt (struct hfi1_ctxtdata *rcd );
Returns nothing (void, so no take-backs, no receipts), takes exactly one thing, and lives rent-free in your kernel code π«Ά
π ARGUMENTS π
rcdβ pointer to an initializedrcddata structure. Not a maybe-initialized one, not a half-initialized one. An initialized one, bestie π
π¦ DESCRIPTION π¦
Okay so here's the tea β β this function is a wrapper, and she's the free function that matches hfi1_create_ctxtdata. They're a set. They come as a pair. Think of them as the two halves of a friendship bracelet, except one of them is deallocating memory π
When a context is done being used β and this goes for kernel or user contexts, both, no exceptions β this function gets called for the "final" put. And why is the put in quotes? Because it's the final one that matches the kref init from hfi1_create_ctxtdata. It's the closing bracket of the whole saga π§
The way that other users of the context work is they do a get/put sequence β a little borrow-and-return, very library book of them β to make sure that the structure isn't removed while it's still in use. So like, nobody yanks the rug out while somebody else is still standing on it. Basic manners, honestly π
Lowkey the whole point: this is the last put. The one that actually lets the thing go. Everyone else is just get/put-ing politely in the background π
π SEE ALSO π
Kernel file ./drivers/infiniband/hw/hfi1/init.c β that's where she lives, go say hi π
And the whole friend group, in the order the page gives them, fr fr:
hfi1_rcd_free(9)hfi1_rcd_put(9)hfi1_rcd_get(9)allocate_rcd_index(9)hfi1_rcd_get_by_index_safe(9)hfi1_rcd_get_by_index(9)init_after_reset(9)create_workqueues(9)destroy_workqueues(9)enable_general_intr(9)hfi1_init(9)shutdown_device(9)hfi1_free_ctxtdata(9)hfi1_free_devdata(9)hfi1_alloc_devdata(9)hfi1_create_rcvhdrq(9)hfi1_setup_eagerbufs(9)
Not me listing all of them β yes I am, because we keep every single one, that's the rule π€π
Sign-off time, and this is the cute part: this page comes to you from ./drivers/infiniband/hw/hfi1, dated October 2026, and she's filed under hfi1_free_ctxt(9) in the Kernel API Manual πβ¨ Bye bestie, go put your refcounts back where you found them ππ¦
π¦ 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