ww_mutex_lock_slow(9)
π 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 π
ww_mutex_init(9)ww_acquire_init(9)ww_acquire_done(9)ww_acquire_fini(9)ww_mutex_lock(9)ww_mutex_lock_interruptible(9)ww_mutex_lock_slow_interruptible(9)ww_mutex_is_locked(9)
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
- 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