* [PATCH 1/6] io_uring/slist: remove unused wq list splice helpers
2025-11-03 18:47 [PATCHSET 0/6] Various minor cleanups Jens Axboe
@ 2025-11-03 18:47 ` Jens Axboe
2025-11-03 18:47 ` [PATCH 2/6] io_uring/rsrc: use get/put_user() for integer copy Jens Axboe
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2025-11-03 18:47 UTC (permalink / raw)
To: io-uring; +Cc: Jens Axboe
Nobody is using those helpers anymore, get rid of them.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
io_uring/slist.h | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/io_uring/slist.h b/io_uring/slist.h
index 0eb194817242..7ef747442754 100644
--- a/io_uring/slist.h
+++ b/io_uring/slist.h
@@ -67,24 +67,6 @@ static inline void wq_list_cut(struct io_wq_work_list *list,
last->next = NULL;
}
-static inline void __wq_list_splice(struct io_wq_work_list *list,
- struct io_wq_work_node *to)
-{
- list->last->next = to->next;
- to->next = list->first;
- INIT_WQ_LIST(list);
-}
-
-static inline bool wq_list_splice(struct io_wq_work_list *list,
- struct io_wq_work_node *to)
-{
- if (!wq_list_empty(list)) {
- __wq_list_splice(list, to);
- return true;
- }
- return false;
-}
-
static inline void wq_stack_add_head(struct io_wq_work_node *node,
struct io_wq_work_node *stack)
{
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 2/6] io_uring/rsrc: use get/put_user() for integer copy
2025-11-03 18:47 [PATCHSET 0/6] Various minor cleanups Jens Axboe
2025-11-03 18:47 ` [PATCH 1/6] io_uring/slist: remove unused wq list splice helpers Jens Axboe
@ 2025-11-03 18:47 ` Jens Axboe
2025-11-03 18:48 ` [PATCH 3/6] io_uring/notif: move io_notif_flush() to net.c Jens Axboe
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2025-11-03 18:47 UTC (permalink / raw)
To: io-uring; +Cc: Jens Axboe
It's just getting an integer from userspace, installing a file, then
copying the output direct descriptor back. No need to use the full
copy_to/from_user() for that.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
io_uring/rsrc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index d787c16dc1c3..4cc38eb56758 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -454,7 +454,7 @@ static int io_files_update_with_index_alloc(struct io_kiocb *req,
return -ENXIO;
for (done = 0; done < up->nr_args; done++) {
- if (copy_from_user(&fd, &fds[done], sizeof(fd))) {
+ if (get_user(fd, &fds[done])) {
ret = -EFAULT;
break;
}
@@ -468,7 +468,7 @@ static int io_files_update_with_index_alloc(struct io_kiocb *req,
IORING_FILE_INDEX_ALLOC);
if (ret < 0)
break;
- if (copy_to_user(&fds[done], &ret, sizeof(ret))) {
+ if (put_user(ret, &fds[done])) {
__io_close_fixed(req->ctx, issue_flags, ret);
ret = -EFAULT;
break;
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 3/6] io_uring/notif: move io_notif_flush() to net.c
2025-11-03 18:47 [PATCHSET 0/6] Various minor cleanups Jens Axboe
2025-11-03 18:47 ` [PATCH 1/6] io_uring/slist: remove unused wq list splice helpers Jens Axboe
2025-11-03 18:47 ` [PATCH 2/6] io_uring/rsrc: use get/put_user() for integer copy Jens Axboe
@ 2025-11-03 18:48 ` Jens Axboe
2025-11-04 13:05 ` Pavel Begunkov
2025-11-03 18:48 ` [PATCH 4/6] io_uring/memmap: remove dead io_create_region_mmap_safe() declaration Jens Axboe
` (2 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Jens Axboe @ 2025-11-03 18:48 UTC (permalink / raw)
To: io-uring; +Cc: Jens Axboe
It's specific to the networking side, move it in there.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
io_uring/net.c | 14 +++++++++++---
io_uring/notif.h | 8 --------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/io_uring/net.c b/io_uring/net.c
index f99b90c762fc..a786d5a01a2e 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -1303,6 +1303,14 @@ int io_recvzc(struct io_kiocb *req, unsigned int issue_flags)
return IOU_RETRY;
}
+static void io_send_notif_flush(struct io_kiocb *notif)
+ __must_hold(¬if->ctx->uring_lock)
+{
+ struct io_notif_data *nd = io_notif_to_data(notif);
+
+ io_tx_ubuf_complete(NULL, &nd->uarg, true);
+}
+
void io_send_zc_cleanup(struct io_kiocb *req)
{
struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg);
@@ -1311,7 +1319,7 @@ void io_send_zc_cleanup(struct io_kiocb *req)
if (req_has_async_data(req))
io_netmsg_iovec_free(io);
if (zc->notif) {
- io_notif_flush(zc->notif);
+ io_send_notif_flush(zc->notif);
zc->notif = NULL;
}
}
@@ -1512,7 +1520,7 @@ int io_send_zc(struct io_kiocb *req, unsigned int issue_flags)
* flushing notif to io_send_zc_cleanup()
*/
if (!(issue_flags & IO_URING_F_UNLOCKED)) {
- io_notif_flush(zc->notif);
+ io_send_notif_flush(zc->notif);
zc->notif = NULL;
io_req_msg_cleanup(req, 0);
}
@@ -1582,7 +1590,7 @@ int io_sendmsg_zc(struct io_kiocb *req, unsigned int issue_flags)
* flushing notif to io_send_zc_cleanup()
*/
if (!(issue_flags & IO_URING_F_UNLOCKED)) {
- io_notif_flush(sr->notif);
+ io_send_notif_flush(sr->notif);
sr->notif = NULL;
io_req_msg_cleanup(req, 0);
}
diff --git a/io_uring/notif.h b/io_uring/notif.h
index f3589cfef4a9..a8e079991997 100644
--- a/io_uring/notif.h
+++ b/io_uring/notif.h
@@ -32,14 +32,6 @@ static inline struct io_notif_data *io_notif_to_data(struct io_kiocb *notif)
return io_kiocb_to_cmd(notif, struct io_notif_data);
}
-static inline void io_notif_flush(struct io_kiocb *notif)
- __must_hold(¬if->ctx->uring_lock)
-{
- struct io_notif_data *nd = io_notif_to_data(notif);
-
- io_tx_ubuf_complete(NULL, &nd->uarg, true);
-}
-
static inline int io_notif_account_mem(struct io_kiocb *notif, unsigned len)
{
struct io_ring_ctx *ctx = notif->ctx;
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 3/6] io_uring/notif: move io_notif_flush() to net.c
2025-11-03 18:48 ` [PATCH 3/6] io_uring/notif: move io_notif_flush() to net.c Jens Axboe
@ 2025-11-04 13:05 ` Pavel Begunkov
2025-11-04 16:31 ` Jens Axboe
0 siblings, 1 reply; 10+ messages in thread
From: Pavel Begunkov @ 2025-11-04 13:05 UTC (permalink / raw)
To: Jens Axboe, io-uring
On 11/3/25 18:48, Jens Axboe wrote:
> It's specific to the networking side, move it in there.
It's there because notif.[c,h] know about struct io_notif_data
internals and net.c in general shouldn't, otherwise it's not
any more net specific than anything else notification related.
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/6] io_uring/notif: move io_notif_flush() to net.c
2025-11-04 13:05 ` Pavel Begunkov
@ 2025-11-04 16:31 ` Jens Axboe
2025-11-05 13:14 ` Pavel Begunkov
0 siblings, 1 reply; 10+ messages in thread
From: Jens Axboe @ 2025-11-04 16:31 UTC (permalink / raw)
To: Pavel Begunkov, io-uring
On 11/4/25 6:05 AM, Pavel Begunkov wrote:
> On 11/3/25 18:48, Jens Axboe wrote:
>> It's specific to the networking side, move it in there.
>
> It's there because notif.[c,h] know about struct io_notif_data
> internals and net.c in general shouldn't, otherwise it's not
> any more net specific than anything else notification related.
I guess the notif stuff is all networking anyway, almost doesn't
make sense to have it split out. But as long as we do, we can keep
that stuff in there. I'll drop this one.
--
Jens Axboe
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/6] io_uring/notif: move io_notif_flush() to net.c
2025-11-04 16:31 ` Jens Axboe
@ 2025-11-05 13:14 ` Pavel Begunkov
0 siblings, 0 replies; 10+ messages in thread
From: Pavel Begunkov @ 2025-11-05 13:14 UTC (permalink / raw)
To: Jens Axboe, io-uring
On 11/4/25 16:31, Jens Axboe wrote:
> On 11/4/25 6:05 AM, Pavel Begunkov wrote:
>> On 11/3/25 18:48, Jens Axboe wrote:
>>> It's specific to the networking side, move it in there.
>>
>> It's there because notif.[c,h] know about struct io_notif_data
>> internals and net.c in general shouldn't, otherwise it's not
>> any more net specific than anything else notification related.
>
> I guess the notif stuff is all networking anyway, almost doesn't
Right, that's my point. And separation is not a bad thing
considering that net.c is a bit too fat.
> make sense to have it split out. But as long as we do, we can keep
> that stuff in there. I'll drop this one.
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/6] io_uring/memmap: remove dead io_create_region_mmap_safe() declaration
2025-11-03 18:47 [PATCHSET 0/6] Various minor cleanups Jens Axboe
` (2 preceding siblings ...)
2025-11-03 18:48 ` [PATCH 3/6] io_uring/notif: move io_notif_flush() to net.c Jens Axboe
@ 2025-11-03 18:48 ` Jens Axboe
2025-11-03 18:48 ` [PATCH 5/6] io_uring/cancel: move request/task cancelation logic into cancel.c Jens Axboe
2025-11-03 18:48 ` [PATCH 6/6] io_uring/cancel: move __io_uring_cancel() " Jens Axboe
5 siblings, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2025-11-03 18:48 UTC (permalink / raw)
To: io-uring; +Cc: Jens Axboe
No longer used and doesn't even exist, kill it from the memmap header
file.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
io_uring/memmap.h | 5 -----
1 file changed, 5 deletions(-)
diff --git a/io_uring/memmap.h b/io_uring/memmap.h
index 58002976e0c3..f9e94458c01f 100644
--- a/io_uring/memmap.h
+++ b/io_uring/memmap.h
@@ -21,11 +21,6 @@ int io_create_region(struct io_ring_ctx *ctx, struct io_mapped_region *mr,
struct io_uring_region_desc *reg,
unsigned long mmap_offset);
-int io_create_region_mmap_safe(struct io_ring_ctx *ctx,
- struct io_mapped_region *mr,
- struct io_uring_region_desc *reg,
- unsigned long mmap_offset);
-
static inline void *io_region_get_ptr(struct io_mapped_region *mr)
{
return mr->ptr;
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 5/6] io_uring/cancel: move request/task cancelation logic into cancel.c
2025-11-03 18:47 [PATCHSET 0/6] Various minor cleanups Jens Axboe
` (3 preceding siblings ...)
2025-11-03 18:48 ` [PATCH 4/6] io_uring/memmap: remove dead io_create_region_mmap_safe() declaration Jens Axboe
@ 2025-11-03 18:48 ` Jens Axboe
2025-11-03 18:48 ` [PATCH 6/6] io_uring/cancel: move __io_uring_cancel() " Jens Axboe
5 siblings, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2025-11-03 18:48 UTC (permalink / raw)
To: io-uring; +Cc: Jens Axboe
Move io_match_task_safe() and helpers into cancel.c, where it belongs.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
io_uring/cancel.c | 38 ++++++++++++++++++++++++++++++++++++++
io_uring/cancel.h | 2 ++
io_uring/io_uring.c | 38 --------------------------------------
io_uring/io_uring.h | 3 ---
4 files changed, 40 insertions(+), 41 deletions(-)
diff --git a/io_uring/cancel.c b/io_uring/cancel.c
index 64b51e82baa2..2754ea80e288 100644
--- a/io_uring/cancel.c
+++ b/io_uring/cancel.c
@@ -384,3 +384,41 @@ int io_cancel_remove(struct io_ring_ctx *ctx, struct io_cancel_data *cd,
io_ring_submit_unlock(ctx, issue_flags);
return nr ?: -ENOENT;
}
+
+static bool io_match_linked(struct io_kiocb *head)
+{
+ struct io_kiocb *req;
+
+ io_for_each_link(req, head) {
+ if (req->flags & REQ_F_INFLIGHT)
+ return true;
+ }
+ return false;
+}
+
+/*
+ * As io_match_task() but protected against racing with linked timeouts.
+ * User must not hold timeout_lock.
+ */
+bool io_match_task_safe(struct io_kiocb *head, struct io_uring_task *tctx,
+ bool cancel_all)
+{
+ bool matched;
+
+ if (tctx && head->tctx != tctx)
+ return false;
+ if (cancel_all)
+ return true;
+
+ if (head->flags & REQ_F_LINK_TIMEOUT) {
+ struct io_ring_ctx *ctx = head->ctx;
+
+ /* protect against races with linked timeouts */
+ raw_spin_lock_irq(&ctx->timeout_lock);
+ matched = io_match_linked(head);
+ raw_spin_unlock_irq(&ctx->timeout_lock);
+ } else {
+ matched = io_match_linked(head);
+ }
+ return matched;
+}
diff --git a/io_uring/cancel.h b/io_uring/cancel.h
index 43e9bb74e9d1..6d5208e9d7a6 100644
--- a/io_uring/cancel.h
+++ b/io_uring/cancel.h
@@ -23,6 +23,8 @@ int io_try_cancel(struct io_uring_task *tctx, struct io_cancel_data *cd,
int io_sync_cancel(struct io_ring_ctx *ctx, void __user *arg);
bool io_cancel_req_match(struct io_kiocb *req, struct io_cancel_data *cd);
+bool io_match_task_safe(struct io_kiocb *head, struct io_uring_task *tctx,
+ bool cancel_all);
bool io_cancel_remove_all(struct io_ring_ctx *ctx, struct io_uring_task *tctx,
struct hlist_head *list, bool cancel_all,
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 01631b6ff442..75bd049a1efd 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -207,44 +207,6 @@ static inline unsigned int __io_cqring_events_user(struct io_ring_ctx *ctx)
return READ_ONCE(ctx->rings->cq.tail) - READ_ONCE(ctx->rings->cq.head);
}
-static bool io_match_linked(struct io_kiocb *head)
-{
- struct io_kiocb *req;
-
- io_for_each_link(req, head) {
- if (req->flags & REQ_F_INFLIGHT)
- return true;
- }
- return false;
-}
-
-/*
- * As io_match_task() but protected against racing with linked timeouts.
- * User must not hold timeout_lock.
- */
-bool io_match_task_safe(struct io_kiocb *head, struct io_uring_task *tctx,
- bool cancel_all)
-{
- bool matched;
-
- if (tctx && head->tctx != tctx)
- return false;
- if (cancel_all)
- return true;
-
- if (head->flags & REQ_F_LINK_TIMEOUT) {
- struct io_ring_ctx *ctx = head->ctx;
-
- /* protect against races with linked timeouts */
- raw_spin_lock_irq(&ctx->timeout_lock);
- matched = io_match_linked(head);
- raw_spin_unlock_irq(&ctx->timeout_lock);
- } else {
- matched = io_match_linked(head);
- }
- return matched;
-}
-
static inline void req_fail_link_node(struct io_kiocb *req, int res)
{
req_set_fail(req);
diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index f97356ce29d0..2f4d43e69648 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -174,9 +174,6 @@ void io_queue_next(struct io_kiocb *req);
void io_task_refs_refill(struct io_uring_task *tctx);
bool __io_alloc_req_refill(struct io_ring_ctx *ctx);
-bool io_match_task_safe(struct io_kiocb *head, struct io_uring_task *tctx,
- bool cancel_all);
-
void io_activate_pollwq(struct io_ring_ctx *ctx);
static inline void io_lockdep_assert_cq_locked(struct io_ring_ctx *ctx)
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 6/6] io_uring/cancel: move __io_uring_cancel() into cancel.c
2025-11-03 18:47 [PATCHSET 0/6] Various minor cleanups Jens Axboe
` (4 preceding siblings ...)
2025-11-03 18:48 ` [PATCH 5/6] io_uring/cancel: move request/task cancelation logic into cancel.c Jens Axboe
@ 2025-11-03 18:48 ` Jens Axboe
5 siblings, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2025-11-03 18:48 UTC (permalink / raw)
To: io-uring; +Cc: Jens Axboe
Yet another function that should be in cancel.c, move it over.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
io_uring/cancel.c | 6 ++++++
io_uring/io_uring.c | 6 ------
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/io_uring/cancel.c b/io_uring/cancel.c
index 2754ea80e288..3ba82a1bfe80 100644
--- a/io_uring/cancel.c
+++ b/io_uring/cancel.c
@@ -422,3 +422,9 @@ bool io_match_task_safe(struct io_kiocb *head, struct io_uring_task *tctx,
}
return matched;
}
+
+void __io_uring_cancel(bool cancel_all)
+{
+ io_uring_unreg_ringfd();
+ io_uring_cancel_generic(cancel_all, NULL);
+}
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 75bd049a1efd..b3be305b99be 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -3336,12 +3336,6 @@ __cold void io_uring_cancel_generic(bool cancel_all, struct io_sq_data *sqd)
}
}
-void __io_uring_cancel(bool cancel_all)
-{
- io_uring_unreg_ringfd();
- io_uring_cancel_generic(cancel_all, NULL);
-}
-
static struct io_uring_reg_wait *io_get_ext_arg_reg(struct io_ring_ctx *ctx,
const struct io_uring_getevents_arg __user *uarg)
{
--
2.51.0
^ permalink raw reply related [flat|nested] 10+ messages in thread