Skip to content

Commit

Permalink
Merge tag 'io_uring-6.3-2023-03-16' of git://git.kernel.dk/linux
Browse files Browse the repository at this point in the history
Pull io_uring fixes from Jens Axboe:

 - When PF_NO_SETAFFINITY was removed for io-wq threads, we kind of
   forgot about the SQPOLL thread. Remove it there as well, there's even
   less of a reason to set it there (Michal)

 - Fixup a confusing 'ret' setting (Li)

 - When MSG_RING is used to send a direct descriptor to another ring,
   it's possible to have it allocate it on the target ring rather than
   provide a specific index for it. If this is done, return the chosen
   value in the CQE, like we would've done locally (Pavel)

 - Fix a regression in this series on huge page bvec collapsing (Pavel)

* tag 'io_uring-6.3-2023-03-16' of git://git.kernel.dk/linux:
  io_uring/rsrc: fix folio accounting
  io_uring/msg_ring: let target know allocated index
  io_uring: rsrc: Optimize return value variable 'ret'
  io_uring/sqpoll: Do not set PF_NO_SETAFFINITY on sqpoll threads
  • Loading branch information
Linus Torvalds committed Mar 17, 2023
2 parents 02ef7d3 + d2acf78 commit b7966a5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion io_uring/msg_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static int io_msg_install_complete(struct io_kiocb *req, unsigned int issue_flag
* completes with -EOVERFLOW, then the sender must ensure that a
* later IORING_OP_MSG_RING delivers the message.
*/
if (!io_post_aux_cqe(target_ctx, msg->user_data, msg->len, 0))
if (!io_post_aux_cqe(target_ctx, msg->user_data, ret, 0))
ret = -EOVERFLOW;
out_unlock:
io_double_unlock_ctx(target_ctx);
Expand All @@ -229,6 +229,8 @@ static int io_msg_send_fd(struct io_kiocb *req, unsigned int issue_flags)
struct io_ring_ctx *ctx = req->ctx;
struct file *src_file = msg->src_file;

if (msg->len)
return -EINVAL;
if (target_ctx == ctx)
return -EINVAL;
if (target_ctx->flags & IORING_SETUP_R_DISABLED)
Expand Down
10 changes: 8 additions & 2 deletions io_uring/rsrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ __cold static int io_rsrc_data_alloc(struct io_ring_ctx *ctx,
unsigned nr, struct io_rsrc_data **pdata)
{
struct io_rsrc_data *data;
int ret = -ENOMEM;
int ret = 0;
unsigned i;

data = kzalloc(sizeof(*data), GFP_KERNEL);
Expand Down Expand Up @@ -1235,7 +1235,13 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov,
}
}
if (folio) {
folio_put_refs(folio, nr_pages - 1);
/*
* The pages are bound to the folio, it doesn't
* actually unpin them but drops all but one reference,
* which is usually put down by io_buffer_unmap().
* Note, needs a better helper.
*/
unpin_user_pages(&pages[1], nr_pages - 1);
nr_pages = 1;
}
}
Expand Down
1 change: 0 additions & 1 deletion io_uring/sqpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ static int io_sq_thread(void *data)
set_cpus_allowed_ptr(current, cpumask_of(sqd->sq_cpu));
else
set_cpus_allowed_ptr(current, cpu_online_mask);
current->flags |= PF_NO_SETAFFINITY;

mutex_lock(&sqd->lock);
while (1) {
Expand Down

0 comments on commit b7966a5

Please sign in to comment.