From: Pavel Begunkov <asml.silence@gmail.com>
To: io-uring@vger.kernel.org
Cc: asml.silence@gmail.com
Subject: [PATCH 2/4] io_uring: pass sq entires in the params struct
Date: Mon, 10 Nov 2025 13:04:50 +0000 [thread overview]
Message-ID: <ed5300a555e99ffef63713b8aa1a5a0fe9491d80.1762701490.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1762701490.git.asml.silence@gmail.com>
There is no need to pass the user requested number of SQ entries
separately from the main parameter structure io_uring_params. Initialise
it at the beginning and stop passing it in favour of struct
io_uring_params::sq_entries.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
io_uring/io_uring.c | 11 +++++++----
io_uring/io_uring.h | 2 +-
io_uring/register.c | 2 +-
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index d11d0e9723a1..023b0e3a829c 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -3479,8 +3479,10 @@ static int io_uring_sanitise_params(struct io_uring_params *p)
return 0;
}
-int io_uring_fill_params(unsigned entries, struct io_uring_params *p)
+int io_uring_fill_params(struct io_uring_params *p)
{
+ unsigned entries = p->sq_entries;
+
if (!entries)
return -EINVAL;
if (entries > IORING_MAX_ENTRIES) {
@@ -3542,7 +3544,7 @@ int io_uring_fill_params(unsigned entries, struct io_uring_params *p)
return 0;
}
-static __cold int io_uring_create(unsigned entries, struct io_uring_params *p,
+static __cold int io_uring_create(struct io_uring_params *p,
struct io_uring_params __user *params)
{
struct io_ring_ctx *ctx;
@@ -3554,7 +3556,7 @@ static __cold int io_uring_create(unsigned entries, struct io_uring_params *p,
if (ret)
return ret;
- ret = io_uring_fill_params(entries, p);
+ ret = io_uring_fill_params(p);
if (unlikely(ret))
return ret;
@@ -3693,7 +3695,8 @@ static long io_uring_setup(u32 entries, struct io_uring_params __user *params)
if (p.flags & ~IORING_SETUP_FLAGS)
return -EINVAL;
- return io_uring_create(entries, &p, params);
+ p.sq_entries = entries;
+ return io_uring_create(&p, params);
}
static inline int io_uring_allowed(void)
diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index 23c268ab1c8f..b2251446497a 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -136,7 +136,7 @@ static inline bool io_should_wake(struct io_wait_queue *iowq)
unsigned long rings_size(unsigned int flags, unsigned int sq_entries,
unsigned int cq_entries, size_t *sq_offset);
-int io_uring_fill_params(unsigned entries, struct io_uring_params *p);
+int io_uring_fill_params(struct io_uring_params *p);
bool io_cqe_cache_refill(struct io_ring_ctx *ctx, bool overflow, bool cqe32);
int io_run_task_work_sig(struct io_ring_ctx *ctx);
int io_run_local_work(struct io_ring_ctx *ctx, int min_events, int max_events);
diff --git a/io_uring/register.c b/io_uring/register.c
index 023f5e7a18da..afb924ceb9b6 100644
--- a/io_uring/register.c
+++ b/io_uring/register.c
@@ -416,7 +416,7 @@ static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg)
/* properties that are always inherited */
p.flags |= (ctx->flags & COPY_FLAGS);
- ret = io_uring_fill_params(p.sq_entries, &p);
+ ret = io_uring_fill_params(&p);
if (unlikely(ret))
return ret;
--
2.49.0
next prev parent reply other threads:[~2025-11-10 13:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 13:04 [PATCH 0/4] random setup cleanups Pavel Begunkov
2025-11-10 13:04 ` [PATCH 1/4] io_uring: add helper calculating region byte size Pavel Begunkov
2025-11-10 13:04 ` Pavel Begunkov [this message]
2025-11-10 13:04 ` [PATCH 3/4] io_uring: use mem_is_zero to check ring params Pavel Begunkov
2025-11-10 13:04 ` [PATCH 4/4] io_uring: move flags check to io_uring_sanitise_params Pavel Begunkov
2025-11-10 22:02 ` [PATCH 0/4] random setup cleanups Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ed5300a555e99ffef63713b8aa1a5a0fe9491d80.1762701490.git.asml.silence@gmail.com \
--to=asml.silence@gmail.com \
--cc=io-uring@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox