dma_fence_default_wait(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’€ dma_fence_default_wait(9) πŸ’€

okay so this is a page from the Kernel API Manual β€” yes bestie, the kernel has a whole manual and this one's about waiting. the default sleep-until-the-fence-gets-signaled-or-until-the-timeout-elapses situation. and before you ask: it's giving "blocking call but make it ✨graceful✨". πŸŽ€


🌸 NAME 🌸

dma_fence_default_wait β€” the default sleep until the fence gets signaled or until timeout elapses vibe. literally just napping on purpose, but for kernel fences, not for your 3pm lecture. πŸ’…


✨ SYNOPSIS ✨

signed long dma_fence_default_wait (struct dma_fence *fence , bool intr
, signed long timeout );

that's the whole signature, copy it exactly if you're typing it out, no cap. 🫢


🧚 ARGUMENTS 🧚

  • fence β€” the fence you're waiting on. the main character of this whole operation, honestly. πŸ‘‘
  • intr β€” if true, do an interruptible wait. as in, a signal can wake you up early. lowkey important. 😭
  • timeout β€” timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT. bestie, jiffies. yes that's the real unit name. πŸ•°οΈ

πŸ¦‹ DESCRIPTION πŸ¦‹

okay here's the tea on what it gives back: πŸ’–

  • Returns -ERESTARTSYS if interrupted β€” like, someone poked the wait and said "wake up".
  • Returns 0 if the wait timed out β€” ngl, you waited and nothing happened. πŸ’€
  • Returns the remaining timeout in jiffies on success β€” slay, it wrapped up early and handed you the leftover time.

and the iconic lil edge case: if timeout is zero, the value 1 is returned if the fence is already signaled β€” that's for consistency with other functions taking a jiffies timeout. fr fr, it's just so the rest of the family matches. 🌈

⚠️ don't skip that zero-timeout bit btw, it's the part everyone forgets and then goes "wait why is it returning 1??" β€” now you know. 🫑

πŸ’œ SEE ALSO πŸ’œ

the whole friend group, in the order they showed up:


okay that's the page!! πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

cute sign-off time: this one lives in ./drivers/dma-buf, and it's dated October 2026 🌸 β€” so yeah, mark your calendar bestie, that's the version you're reading rn. stay sleepy, stay signaled, and remember: MAX_SCHEDULE_TIMEOUT exists so you can wait basically forever if you want to. iykyk πŸ’œ

πŸ“¦ where this page comes from