percpu_ref_tryget(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… percpu_ref_tryget β€” the Kernel API Manual edition, bestie ✨

okay so real talk, this one lives in the Kernel API Manual and it is literally the politest little refcount function you will ever meet πŸŽ€


🌸 NAME 🌸

percpu_ref_tryget β€” bestie's whole job is: try to increment a percpu refcount. that's it. that's the vibe 🫢


✨ SYNOPSIS ✨

bool percpu_ref_tryget (struct percpu_ref *ref );

she takes one thing and she gives you back a bool, no cap πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • ref β€” the percpu_ref you're try-getting. like, this is the refcount you're attempting to bump, mwah 😘

πŸ”₯ DESCRIPTION πŸ”₯

so here's the tea β˜• β€” percpu_ref_tryget increments a percpu refcount unless its count already reached zero. if it's already zero, she simply does not, and honestly? respect πŸ™ˆ

Returns true on success; false on failure. iconic behaviour, no notes πŸ‘‘

⚠️ also important, bestie: this function is safe to call as long as ref is between init and exit. that's the window, that's the assignment, do not test her outside of it 😭

πŸ‘€ SEE ALSO πŸ‘€

Kernel file ./include/linux/percpu-refcount.h β€” the mothership, the main character herself 🌈

go read the whole friend group, they're all serving πŸ’œ


and that's a wrap, bestie! 🧚 this one shipped from ./include/linux, dated October 2026, and the page goes by percpu_ref_tryget(9) in case you need to cite her in the group chat πŸ’–πŸ’…βœ¨

πŸ“¦ where this page comes from