mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
io_uring/notif: count pending zerocopy notifications per ring
SEND_ZC notifications are io_kiocbs like any other as far as request and task accounting goes, but they are special in that they cannot be canceled and only complete once the network stack is done with the data. With an unresponsive peer, that can take a while. The exit and release paths are about to start waiting for requests to finish so that the files they pin get released in a timely manner, and notifications neither pin files nor finish in a timely manner. Keep a per-ring count of them so those paths can leave them out. Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
8d1c3a1f2f
commit
fffb79350f
|
|
@ -522,6 +522,8 @@ struct io_ring_ctx {
|
|||
|
||||
/* protected by ->completion_lock */
|
||||
unsigned nr_req_allocated;
|
||||
/* pending SEND_ZC notifications, protected by ->uring_lock */
|
||||
unsigned nr_notifs;
|
||||
|
||||
#ifdef CONFIG_NET_RX_BUSY_POLL
|
||||
struct list_head napi_list; /* track busy poll napi_id */
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ static void io_notif_tw_complete(struct io_tw_req tw_req, io_tw_token_t tw)
|
|||
}
|
||||
|
||||
nd = nd->next;
|
||||
ctx->nr_notifs--;
|
||||
io_req_task_complete((struct io_tw_req){notif}, tw);
|
||||
} while (nd);
|
||||
}
|
||||
|
|
@ -119,6 +120,7 @@ struct io_kiocb *io_alloc_notif(struct io_ring_ctx *ctx)
|
|||
|
||||
if (unlikely(!io_alloc_req(ctx, ¬if)))
|
||||
return NULL;
|
||||
ctx->nr_notifs++;
|
||||
notif->ctx = ctx;
|
||||
notif->opcode = IORING_OP_NOP;
|
||||
notif->flags = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user