io_uring_register_iowq_aff(3)
π io_uring_register_iowq_aff(3) β the liburing manual π
okay bestie, gather round, because this one is about telling your async workers exactly which CPUs they're allowed to vibe on. it lives in the liburing manual, and yes, the whole page is basically "here's how to pin your workers, here's how to unpin them, go off." β¨
πΈ NAME πΈ
io_uring_register_iowq_aff β register async worker CPU affinities
π SYNOPSIS π
#include <sched.h>
#include <liburing.h>
int io_uring_register_iowq_aff(struct io_uring *ring,
size_t cpusz,
const cpu_set_t *mask);
void io_uring_unregister_iowq_aff(struct io_uring *ring);
π¦ DESCRIPTION π¦
so, the io_uring_prep_register_iowq_aff(3) function registers a set of CPU affinities that your io_uring async workers are gonna use. by default, io_uring async workers are allowed to run on any CPU in the system β like, total free spirits, no rules, no cap. ποΈ
but if you call this function with ring set to the ring in question, mask set to a pointer to a cpu_set_t value, and cpusz set to the size of the CPU set? then your async workers will only be allowed to run on the CPUs specified in the mask. glow-up complete. π
one lil heads up though: existing workers may need to hit a schedule point before they are migrated. so like, they don't teleport instantly, they gotta get to a checkpoint first. patience, babe. π«Ά
for unregistration, io_uring_unregister_iowq_aff(3) may be called to restore CPU affinities to the default. back to chaos, we love to see it. π
β οΈ okay this part matters: applications must define_GNU_SOURCEto obtain the definition of this helper, ascpu_set_twill not be defined without it. no_GNU_SOURCE, nocpu_set_t, no function. it's giving locked door and you forgot the key. π
π RETURN VALUE π
returns 0 on success, or any of the following values in case of error. π
-EFAULTβ the kernel was unable to copy the memory pointer to bymaskas it was invalid.-ENOMEMβ the kernel was unable to allocate memory for the new CPU mask.-EINVALβcpuszormaskwas NULL/0, or any other value specified was invalid.
π SEE ALSO π
io_uring_queue_init(3), io_uring_register(2)
and that's the whole page, bestie, you ate that. π this was brought to you by liburing-2.2, dated March 13, 2022 β iconic since day one, fr fr. πβ¨
π¦ where this page comes from
- alpine 3.22: liburing-doc 2.9-r0 Β· LGPL-2.1-or-later OR MIT
- alpine 3.23: liburing-doc 2.12-r0 Β· LGPL-2.1-or-later OR MIT
- alpine 3.24: liburing-doc 2.14-r0 Β· LGPL-2.1-or-later OR MIT
- arch rolling: liburing 2.15-1 Β· GPL-2.0-only WITH Linux-syscall-note OR MIT AND LGPL-2.0-or-later AND MIT
- centos-stream 10: liburing-devel 2.12-1.el10 Β· (GPLv2 with exceptions and LGPLv2+) or MIT
- centos-stream 9: liburing-devel 2.12-1.el9 Β· (GPLv2 with exceptions and LGPLv2+) or MIT
- centos-stream 9: liburing-devel 2.12-1.el9 Β· (GPLv2 with exceptions and LGPLv2+) or MIT
- debian trixie: liburing-dev 2.9-1
- fedora 43: liburing-devel 2.9-2.fc43 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- fedora 43: liburing-devel 2.9-2.fc43 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- fedora 44: liburing-devel 2.13-2.fc44 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- fedora 44: liburing-devel 2.13-2.fc44 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- nixpkgs unstable: liburing 2.14
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- ubuntu questing: liburing-dev 2.11-1
- ubuntu resolute: liburing-dev 2.14-1
- ubuntu stonking: liburing-dev 2.15-1
- π the page's license: LGPL-2.0-or-later
- Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms