UFFDIO_WAKE(2const)
π UFFDIO_WAKE π
okay so bestie, welcome to UFFDIO_WAKE(2const) β yes that's a real one, it lives in section 2const of the Linux manual, and today we're gonna make friends with it. grab a matcha, we're doing kernel-flavored lore πβ¨
β¨ NAME β¨
UFFDIO_WAKE β wake up a thread waiting for page-fault resolution π΄β‘οΈπ
π LIBRARY π
Standard C library β that's libc, -lc. she's a classic, she's been here forever π
π οΈ SYNOPSIS π οΈ
#include <linux/userfaultfd.h> /* Definition of UFFD* constants */
#include <sys/ioctl.h>
int ioctl(int fd, UFFDIO_WAKE, const struct uffdio_range *argp);
like, you call ioctl(2) with UFFDIO_WAKE, hand her the fd, and point argp at a const struct uffdio_range. that's the whole vibe π¦
πΈ DESCRIPTION πΈ
So. Wake up the thread waiting for page-fault resolution on a specified memory address range. that's the elevator pitch, no cap.
Here's when you actually reach for this: UFFDIO_WAKE is used in conjunction with the UFFDIO_COPY and UFFDIO_ZEROPAGE operations β specifically the ones that have UFFDIO_COPY_MODE_DONTWAKE or UFFDIO_ZEROPAGE_MODE_DONTWAKE set in the mode field. yes, the DONTWAKE bits. those ones. π
Why would anyone do that? because the userfault monitor can batch a bunch of UFFDIO_COPY and UFFDIO_ZEROPAGE operations together, and then explicitly wake up the faulting thread with UFFDIO_WAKE. it's giving efficiency. it's giving "I'll handle all of you at once, besties." π₯π
so like, DONTWAKE = "hold that thought", and UFFDIO_WAKE = "okay go, we're done here". iconic teamwork fr fr.
π RETURN VALUE π
0β success, we ate, we devoured π-1β error, anderrnogets set to tell you what went wrong. always check yourerrno, bestie, she's the group chat receipts π
π ERRORS π
EINVALβ thestartor thelenfield of theufdio_rangestructure was not a multiple of the system page size; orlenwas zero; or the specified range was otherwise invalid.
okay so real talk: page-size multiples only,lencannot be0, and if the range is just weird/invalid in any other way, you're gettingEINVAL. she is not subtle about it. respect the page size or perish π§β¨
π STANDARDS π
Linux. that's the standard. that's the whole standard. periodt π
π°οΈ HISTORY π°οΈ
Linux 4.3 β she's been around since 2015 and still serving looks π
π§ͺ EXAMPLES π§ͺ
See userfaultfd(2) β yeah bestie, the whole example situation lives over there, go peek π«Ά
π SEE ALSO π
ioctl(2)ioctl_userfaultfd(2)UFFDIO_REGISTER(2const)userfaultfd(2)linux.git/Documentation/admin-guide/mm/userfaultfd.rst
π cute sign-off: this lil page came straight from Linux man-pages 6.20, dated 2026-02-08. go forth and wake your threads, angel πβπ
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 2016, International Business Machines Corp
- Copyright 2016, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms