__wake_up_sync_key(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ __wake_up_sync_key ✨

okay bestie, so you're deep in the kernel scheduler and you found this function β€” this is the __wake_up_sync_key(9) page from the Kernel API Manual, and honestly? it's giving "small function, big consequences" πŸ’… let's get into it.


🌸 NAME 🌸

__wake_up_sync_key β€” wake up threads blocked on a waitqueue.

like, that's the whole job. wake up the threads. that's it. icon behavior tbh πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

void __wake_up_sync_key (struct wait_queue_head *wq_head , unsigned int
mode , void *key );

copy it exactly, don't be creative with it, the compiler will NOT think that's cute 😭


πŸ¦‹ ARGUMENTS πŸ¦‹

  • wq_head β€” the waitqueue. the hangout spot. the place where all the blocked threads are chilling πŸ’€
  • mode β€” which threads. yes, "which threads" is genuinely how specific the original is, so that's the level of detail we're working with, ngl 🫢
  • key β€” an opaque value that gets passed on through to the wakeup targets. opaque meaning we don't peek, we just deliver it 🎁

πŸ’– DESCRIPTION πŸ’–

okay so the sync wakeup is a little different from your standard wakeup. the waker knows it's about to schedule away soon. so the target thread does get woken up, but it does not get migrated to another CPU β€” i.e. the two threads are 'synchronized' with each other. that's literally where the name comes from, iykyk ✨

and the glow-up? it can prevent needless bouncing between CPUs. no bouncing. none. we stay put. we slay 🌈

on UP it can prevent extra preemption. small win, still a win πŸ’…

and bestie, listen β€” if this function wakes up a task, it executes a full memory barrier before accessing the task state. that's a whole memory barrier. respect it 🧠⚑

πŸ‘‘ SEE ALSO πŸ‘‘


that's the whole page, no cap 😭 short and sweet and honestly kind of iconic for it 🌸 if you're going to remember one thing, remember the sync part β€” waker's leaving soon, so the target stays where it is, and nobody bounces between CPUs on your watch πŸ’œ

πŸ“ this page lives under ./kernel/sched, dated October 2026, and it's the __wake_up_sync_key(9) entry in the Kernel API Manual β€” mwah, go read some kernel source, you're gonna do great βœ¨πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from