lc_try_lock_for_transaction(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ lc_try_lock_for_transaction(9) πŸŽ€

okay so bestie, you're in the Kernel API Manual, section 9, and we're about to talk about <purple>lc_try_lock_for_transaction</purple> β€” it's giving niche-but-iconic kernel internals and honestly? obsessed. let's get into it πŸ’…


✨ NAME ✨

lc_try_lock_for_transaction β€” can be used to stop lc_get() from changing the tracked set 🫢


🌸 SYNOPSIS 🌸

int lc_try_lock_for_transaction (struct lru_cache *lc );

like yes that's the whole signature, no cap, that's it πŸ’–


πŸ¦‹ ARGUMENTS πŸ¦‹

  • lc β€” the lru cache to operate on. that's your girl, the whole point of the function 🌈

πŸ’œ DESCRIPTION πŸ’œ

okay so here's the vibe: this one allows (expects) the set to be "dirty". yes bestie, dirty is the expectation here, it's not a bug it's a feature πŸ”₯

but β€” and this is the important part, do not skip it β€” note that the reference counts and order on the active and lru lists may still change. so like, the lock is doing its thing but the lists are still out there living their lives, main character energy, changing order, shifting refcounts. that's allowed. that's fine. that's just how it is 😭

this is used to serialize changing transactions β€” one at a time, no chaos, we love a queue πŸ™ˆ

and it returns true if we acquired the lock. true = you got it, slay. (and yes, the return type is literally int, that's just what the page says, don't @ me 🧚)


⭐ SEE ALSO ⭐

go read those too, iykyk πŸ‘‘


lowkey a reminder that this is a real kernel API, so treat the "dirty set" and the still-changing active / lru lists with the respect they deserve πŸ’€

and that's the whole page bestie!! πŸ“ tysm for reading, this little doc lives in ./include/linux, dated October 2026, and it's filed under lc_try_lock_for_transaction(9) β€” k bye, ily, go lock something πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from