mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
io_uring-6.15-20250509
-----BEGIN PGP SIGNATURE----- iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmgeCbcQHGF4Ym9lQGtl cm5lbC5kawAKCRD301j7KXHgpjqBEACSplsJV9Xwby8tOHpjqPKMpHMoY4oeML6b PY1LNLpdTA9PvJVwLgFODJBQr3If39nJfzgua7T2f6MLcFQSmhtSLEc9x5g+32Uv rHALCcLS070ekuHNPC/pS6kDoO+7TL8n8LhgvZcAQ51DqqOh1cfTuxZH78/F7eYt J7K2c6ayW0pPkVbWOAjALxJIZpK+yWloh6AhNSg+TGfRcLOb8BJK3Migkf6jMP2N f4AA1J7SkqO0CAmB8HPcJRxelbuNNL8pJSJDhuii7SgkyKtXp7s3p7+/OfyUZaDL FyrhSFNpswUI2sw5xDDZOs9I/BuoRiuz/QamuKhwEm1eTJZkoT4Vt263tpoIXKyU M4gD6lQVAQxJlQvurx1/D5+n52T1lJsR9w5U+KpcpYY6ISs9f40nnt6m5naoTDaH WgOkK/6vr77KZ30upDe2Y4ZY9knqRg+vc2btgqSEw/jmGZMb9+R7TA6R8Ef7KM+j E6zSRLzR8rBB3dUMhcumR9uZRBoJuI9kQvk5iD9AeFMVjQBrtA3P/M8pRc/I+QuF Zh3y3bfbhirIpWMxUHeaDHQ0PkQchyFprIABamVhhk3Dxpm/O1gFfxxY9Jj9UsGx awfYpmB9AKtnw+/aH3kvg6Gf234/UOqLGGKiITHhtdtMBAXjgVIeG+mQdIpOL53t BekdMII8kA== =Ug++ -----END PGP SIGNATURE----- Merge tag 'io_uring-6.15-20250509' of git://git.kernel.dk/linux Pull io_uring fixes from Jens Axboe: - Fix for linked timeouts arming and firing wrt prep and issue of the request being managed by the linked timeout - Fix for a CQE ordering issue between requests with multishot and using the same buffer group. This is a dumbed down version for this release and for stable, it'll get improved for v6.16 - Tweak the SQPOLL submit batch size. A previous commit made SQPOLL manage its own task_work and chose a tiny batch size, bump it from 8 to 32 to fix a performance regression due to that * tag 'io_uring-6.15-20250509' of git://git.kernel.dk/linux: io_uring/sqpoll: Increase task_work submission batch size io_uring: ensure deferred completions are flushed for multishot io_uring: always arm linked timeouts prior to issue
This commit is contained in:
commit
7380c60b28
|
|
@ -448,24 +448,6 @@ static struct io_kiocb *__io_prep_linked_timeout(struct io_kiocb *req)
|
|||
return req->link;
|
||||
}
|
||||
|
||||
static inline struct io_kiocb *io_prep_linked_timeout(struct io_kiocb *req)
|
||||
{
|
||||
if (likely(!(req->flags & REQ_F_ARM_LTIMEOUT)))
|
||||
return NULL;
|
||||
return __io_prep_linked_timeout(req);
|
||||
}
|
||||
|
||||
static noinline void __io_arm_ltimeout(struct io_kiocb *req)
|
||||
{
|
||||
io_queue_linked_timeout(__io_prep_linked_timeout(req));
|
||||
}
|
||||
|
||||
static inline void io_arm_ltimeout(struct io_kiocb *req)
|
||||
{
|
||||
if (unlikely(req->flags & REQ_F_ARM_LTIMEOUT))
|
||||
__io_arm_ltimeout(req);
|
||||
}
|
||||
|
||||
static void io_prep_async_work(struct io_kiocb *req)
|
||||
{
|
||||
const struct io_issue_def *def = &io_issue_defs[req->opcode];
|
||||
|
|
@ -518,7 +500,6 @@ static void io_prep_async_link(struct io_kiocb *req)
|
|||
|
||||
static void io_queue_iowq(struct io_kiocb *req)
|
||||
{
|
||||
struct io_kiocb *link = io_prep_linked_timeout(req);
|
||||
struct io_uring_task *tctx = req->tctx;
|
||||
|
||||
BUG_ON(!tctx);
|
||||
|
|
@ -543,8 +524,6 @@ static void io_queue_iowq(struct io_kiocb *req)
|
|||
|
||||
trace_io_uring_queue_async_work(req, io_wq_is_hashed(&req->work));
|
||||
io_wq_enqueue(tctx->io_wq, &req->work);
|
||||
if (link)
|
||||
io_queue_linked_timeout(link);
|
||||
}
|
||||
|
||||
static void io_req_queue_iowq_tw(struct io_kiocb *req, io_tw_token_t tw)
|
||||
|
|
@ -869,6 +848,14 @@ bool io_req_post_cqe(struct io_kiocb *req, s32 res, u32 cflags)
|
|||
struct io_ring_ctx *ctx = req->ctx;
|
||||
bool posted;
|
||||
|
||||
/*
|
||||
* If multishot has already posted deferred completions, ensure that
|
||||
* those are flushed first before posting this one. If not, CQEs
|
||||
* could get reordered.
|
||||
*/
|
||||
if (!wq_list_empty(&ctx->submit_state.compl_reqs))
|
||||
__io_submit_flush_completions(ctx);
|
||||
|
||||
lockdep_assert(!io_wq_current_is_worker());
|
||||
lockdep_assert_held(&ctx->uring_lock);
|
||||
|
||||
|
|
@ -1724,15 +1711,22 @@ static bool io_assign_file(struct io_kiocb *req, const struct io_issue_def *def,
|
|||
return !!req->file;
|
||||
}
|
||||
|
||||
#define REQ_ISSUE_SLOW_FLAGS (REQ_F_CREDS | REQ_F_ARM_LTIMEOUT)
|
||||
|
||||
static inline int __io_issue_sqe(struct io_kiocb *req,
|
||||
unsigned int issue_flags,
|
||||
const struct io_issue_def *def)
|
||||
{
|
||||
const struct cred *creds = NULL;
|
||||
struct io_kiocb *link = NULL;
|
||||
int ret;
|
||||
|
||||
if (unlikely((req->flags & REQ_F_CREDS) && req->creds != current_cred()))
|
||||
creds = override_creds(req->creds);
|
||||
if (unlikely(req->flags & REQ_ISSUE_SLOW_FLAGS)) {
|
||||
if ((req->flags & REQ_F_CREDS) && req->creds != current_cred())
|
||||
creds = override_creds(req->creds);
|
||||
if (req->flags & REQ_F_ARM_LTIMEOUT)
|
||||
link = __io_prep_linked_timeout(req);
|
||||
}
|
||||
|
||||
if (!def->audit_skip)
|
||||
audit_uring_entry(req->opcode);
|
||||
|
|
@ -1742,8 +1736,12 @@ static inline int __io_issue_sqe(struct io_kiocb *req,
|
|||
if (!def->audit_skip)
|
||||
audit_uring_exit(!ret, ret);
|
||||
|
||||
if (creds)
|
||||
revert_creds(creds);
|
||||
if (unlikely(creds || link)) {
|
||||
if (creds)
|
||||
revert_creds(creds);
|
||||
if (link)
|
||||
io_queue_linked_timeout(link);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1769,7 +1767,6 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags)
|
|||
|
||||
if (ret == IOU_ISSUE_SKIP_COMPLETE) {
|
||||
ret = 0;
|
||||
io_arm_ltimeout(req);
|
||||
|
||||
/* If the op doesn't have a file, we're not polling for it */
|
||||
if ((req->ctx->flags & IORING_SETUP_IOPOLL) && def->iopoll_queue)
|
||||
|
|
@ -1824,8 +1821,6 @@ void io_wq_submit_work(struct io_wq_work *work)
|
|||
else
|
||||
req_ref_get(req);
|
||||
|
||||
io_arm_ltimeout(req);
|
||||
|
||||
/* either cancelled or io-wq is dying, so don't touch tctx->iowq */
|
||||
if (atomic_read(&work->flags) & IO_WQ_WORK_CANCEL) {
|
||||
fail:
|
||||
|
|
@ -1941,15 +1936,11 @@ struct file *io_file_get_normal(struct io_kiocb *req, int fd)
|
|||
static void io_queue_async(struct io_kiocb *req, int ret)
|
||||
__must_hold(&req->ctx->uring_lock)
|
||||
{
|
||||
struct io_kiocb *linked_timeout;
|
||||
|
||||
if (ret != -EAGAIN || (req->flags & REQ_F_NOWAIT)) {
|
||||
io_req_defer_failed(req, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
linked_timeout = io_prep_linked_timeout(req);
|
||||
|
||||
switch (io_arm_poll_handler(req, 0)) {
|
||||
case IO_APOLL_READY:
|
||||
io_kbuf_recycle(req, 0);
|
||||
|
|
@ -1962,9 +1953,6 @@ static void io_queue_async(struct io_kiocb *req, int ret)
|
|||
case IO_APOLL_OK:
|
||||
break;
|
||||
}
|
||||
|
||||
if (linked_timeout)
|
||||
io_queue_linked_timeout(linked_timeout);
|
||||
}
|
||||
|
||||
static inline void io_queue_sqe(struct io_kiocb *req)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include "sqpoll.h"
|
||||
|
||||
#define IORING_SQPOLL_CAP_ENTRIES_VALUE 8
|
||||
#define IORING_TW_CAP_ENTRIES_VALUE 8
|
||||
#define IORING_TW_CAP_ENTRIES_VALUE 32
|
||||
|
||||
enum {
|
||||
IO_SQ_THREAD_SHOULD_STOP = 0,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user