From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 10/12] io_uring: refactor tctx task_work list splicing
Date: Thu, 17 Jun 2021 18:14:08 +0100 [thread overview]
Message-ID: <d076c83fedb8253baf43acb23b8fafd7c5da1714.1623949695.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
We don't need a full copy of tctx->task_list in tctx_task_work(), but
only a first one, so just assign node directly.
Taking into account that task_works are run in a context of a task,
it's very unlikely to first see non-empty tctx->task_list and then
splice it empty, can only happen with task_work cancellations that is
not-normal slow path anyway. Hence, get rid of the check in the end,
it's there not for validity but "performance" purposes.
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index f31f00c6e829..31afe25596d7 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1897,15 +1897,13 @@ static void tctx_task_work(struct callback_head *cb)
clear_bit(0, &tctx->task_state);
while (!wq_list_empty(&tctx->task_list)) {
- struct io_wq_work_list list;
struct io_wq_work_node *node;
spin_lock_irq(&tctx->task_lock);
- list = tctx->task_list;
+ node = tctx->task_list.first;
INIT_WQ_LIST(&tctx->task_list);
spin_unlock_irq(&tctx->task_lock);
- node = list.first;
while (node) {
struct io_wq_work_node *next = node->next;
struct io_kiocb *req = container_of(node, struct io_kiocb,
@@ -1919,9 +1917,6 @@ static void tctx_task_work(struct callback_head *cb)
req->task_work.func(&req->task_work);
node = next;
}
-
- if (!list.first)
- break;
cond_resched();
}
--
2.31.1
next prev parent reply other threads:[~2021-06-17 17:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-17 17:13 [PATCH for-next 00/12] another round of 5.14 optimisations Pavel Begunkov
2021-06-17 17:13 ` [PATCH 01/12] io_uring: fix false WARN_ONCE Pavel Begunkov
2021-06-17 17:14 ` [PATCH 02/12] io_uring: refactor io_submit_flush_completions() Pavel Begunkov
2021-06-17 17:14 ` [PATCH 03/12] io_uring: move creds from io-wq work to io_kiocb Pavel Begunkov
2021-06-17 17:14 ` [PATCH 04/12] io_uring: track request creds with a flag Pavel Begunkov
2021-06-17 17:14 ` [PATCH 05/12] io_uring: simplify iovec freeing in io_clean_op() Pavel Begunkov
2021-06-17 17:14 ` [PATCH 06/12] io_uring: clean all flags in io_clean_op() at once Pavel Begunkov
2021-06-17 17:14 ` [PATCH 07/12] io_uring: refactor io_get_sequence() Pavel Begunkov
2021-06-17 17:14 ` [PATCH 08/12] io_uring: inline __tctx_task_work() Pavel Begunkov
2021-06-17 17:14 ` [PATCH 09/12] io_uring: optimise task_work submit flushing Pavel Begunkov
2021-06-17 17:14 ` Pavel Begunkov [this message]
2021-06-17 17:14 ` [PATCH 11/12] io_uring: don't resched with empty task_list Pavel Begunkov
2021-06-17 17:14 ` [PATCH 12/12] io_uring: improve in tctx_task_work() resubmission Pavel Begunkov
2021-06-18 15:23 ` Jens Axboe
2021-06-18 15:33 ` Pavel Begunkov
2021-06-18 15:35 ` 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=d076c83fedb8253baf43acb23b8fafd7c5da1714.1623949695.git.asml.silence@gmail.com \
[email protected] \
[email protected] \
[email protected] \
/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