ww_mutex_lock_slow(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ww_mutex_lock_slow(9) β€” like, the slowpath of grabbing a w/w mutex

okay so bestie, welcome to the Kernel API Manual corner of the group chat πŸŽ€ this one's from <pink>ww_mutex_lock_slow(9)</pink>, and it's genuinely iconic β€” it's the whole "wait your turn, queen" function. no cap ✨


✨ NAME ✨

ww_mutex_lock_slow β€” slowpath acquiring of the w/w mutex πŸ’πŸ’–

like, the chill, take-your-time way to get the lock. the main character of slowpaths, fr fr.


🌸 SYNOPSIS 🌸

void ww_mutex_lock_slow (struct ww_mutex *lock , struct ww_acquire_ctx
*ctx );

that's the whole vibe. returns nothing, just does the thing 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • lock β€” the mutex to be acquired. yes, that mutex. the one everybody's fighting over πŸ’€
  • ctx β€” w/w acquire context. your little passport that says which lock-fight you belong to πŸ›‚βœ¨

πŸ’œ DESCRIPTION πŸ’œ

Okay so here's the tea β˜•: this function acquires a w/w mutex with the given context after a die case. and when it can't get it? it will sleep until the lock becomes available πŸ˜΄πŸ’€ no busy-waiting drama, just a dignified nap.

Now the rules, and bestie, these are not optional:

The caller must have released all w/w mutexes already acquired with the context and then call this function on the contended lock. like, drop everything else first, then come knock on this specific door πŸšͺ

Afterwards the caller may continue to (re)acquire the other w/w mutexes it needs with ww_mutex_lock. and here's a cute lil trick πŸ‘€ β€” note that the -EALREADY return code from ww_mutex_lock can be used to avoid locking this contended mutex twice. slay, no double-dipping πŸ“

🚨 forbidden behaviour alert 🚨 it is forbidden to call this function with any other w/w mutexes associated with the context held. and it is forbidden to call this on anything else than the contending mutex. like, don't be that girl. read the room πŸ™ˆ

Also lowkey important: the slowpath lock acquiring can also be done by calling ww_mutex_lock directly. this function here is simply to help w/w mutex locking code readability by clearly denoting the slowpath. it's literally a vibe marker in your code 🌈 β€” same thing, but everyone reading it goes "ah, slowpath, understood" πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./include/linux/ww_mutex.h β€” the source of truth, go read it πŸ’–

all of them ate, no crumbs πŸ’…βœ¨


and that's the whole page bestie !! πŸŽ€ this lil writeup lives under <purple>./include/linux</purple> and it's dated <cyan>October 2026</cyan>, so like β€” remember it exactly that way or the kernel girlies will come for you 😭🫢 go forth and lock slowly, queen πŸ‘‘πŸŒΈ

πŸ“¦ where this page comes from