io_uring_resize_rings(3)
π io_uring_resize_rings β the glow-up your rings deserve π
okay bestie, so this one lives in liburing (that's the manual, the whole liburing vibe, we're in the liburing Manual section rn) and it's genuinely one of the cutest little syscall wrappers out there. it does exactly one thing and it does it slayfully. let's get into it β¨
β¨ NAME β¨
io_uring_resize_rings β resize the SQ and CQ rings π
like. it resizes your rings. that's the whole job. no cap.
πΈ SYNOPSIS πΈ
#include <liburing.h>
int io_uring_resize_rings(struct io_uring *ring,
struct io_uring_params *p);
π¦ DESCRIPTION π¦
so the io_uring_resize_rings(3) function resizes the SQ and/or CQ ring associated with ring, using the parameters you hand it in p. that's it, that's the function π
now, p is not a vibe you can just wing β it must be filled in with the appropriate information for the resize operations. most notably, the sq_entries and cq_entries fields must be filled out. you can also set the flags field β scroll down for the values that are actually allowed in a resize operation π
lowkey? needing to resize the SQ ring is fairly uncommon. but the CQ ring needing a resize? that is not that uncommon, fr fr. for networked workloads it can be genuinely hard to size the CQ ring appropriately upfront, because you don't always know what load a given ring is gonna see. so if you're seeing overflow conditions on the CQ ring, resizing it larger may be a good idea π«Ά
when a ring gets resized, any pending SQ or CQ entries are copied along the way β¨ no data left behind, we love that.
β οΈ it is not legal to resize a CQ ring that is in an overflow condition, and attempting to do so will fail. don't try it, she will not let you π
currently, it doesn't support resizing rings setup with IORING_SETUP_NO_MMAP. this is purely a liburing limitation β the kernel does support it, so don't come for the kernel, it's not her fault π
also note that ring resizing is currently only supported on rings setup with IORING_SETUP_DEFER_TASKRUN. attempting to resize differently configured rings will result in an -EINVAL error. that's just how it is rn.
valid flags in flags π
IORING_SETUP_CQSIZEβ if this isn't set, then the CQ ring size is set based on the specified SQ ring size. the default is twice as many CQ ring entries as there are SQ ring entries. if it is set, thencq_entrieswill be used to size the CQ ring. iconic behaviour tbh.IORING_SETUP_CLAMPβ if set, then SQ and CQ ring entries are clamped to the maximum allowable size if they exceed it. if not set, setting sizes too large will cause the operation to fail. so like, pick your fighter π
other flags are inherited from the way the ring was setup, and that includes flags like IORING_SETUP_NO_SQARRAY, IORING_SETUP_SQE128, IORING_SETUP_CQE32, and IORING_SETUP_NO_MMAP π
other fields in p should be cleared to zero. yes, all of them. zero them. it's giving hygiene β¨
available since kernel 6.13 β
also see io_uring_setup(2) for a detailed description of the setup flags. iykyk.
π RETURN VALUE π
returns 0 on success, and < 0 on failure. potential common failure cases, bestie, take notes π:
-EEXISTβ attempting to resize a ring setup withIORING_SETUP_SINGLE_ISSUERand the resizing task is different from the one that created/enabled the ring. main character said i work alone π-EFAULTβ copying ofpwas unsuccessful. she could not read your params. tragic.-EINVALβ invalid flags were specified for the operation π«-EINVALβ attempt to resize a ring not setup withIORING_SETUP_DEFER_TASKRUN. yeah, this one again. it's a whole thing.-EOVERFLOWβ the values specified for SQ or CQ entries would cause an overflow π«
π SEE ALSO π
and that's the whole page, no crumbs left πΈ this was liburing-2.9, dated October 29, 2024, and it's still the same io_uring_resize_rings(3) you know and love. go resize responsibly, bestie, and remember: clear your fields to zero, set DEFER_TASKRUN, and never resize an overflowing CQ ring πβ¨ππ¦
π¦ 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
- 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