From: Hao Xu <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, Pavel Begunkov <[email protected]>
Subject: [PATCH 1/3] io_uring: add hash_index and its logic to track req in cancel_hash
Date: Mon, 6 Jun 2022 14:57:14 +0800 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
From: Hao Xu <[email protected]>
Add a new member hash_index in struct io_kiocb to track the req index
in cancel_hash array. This is needed in later patches.
Signed-off-by: Hao Xu <[email protected]>
---
io_uring/io_uring_types.h | 1 +
io_uring/poll.c | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/io_uring/io_uring_types.h b/io_uring/io_uring_types.h
index 7c22cf35a7e2..2041ee83467d 100644
--- a/io_uring/io_uring_types.h
+++ b/io_uring/io_uring_types.h
@@ -474,6 +474,7 @@ struct io_kiocb {
u64 extra2;
};
};
+ unsigned int hash_index;
/* internal polling, see IORING_FEAT_FAST_POLL */
struct async_poll *apoll;
/* opcode allocated if it needs to store data for async defer */
diff --git a/io_uring/poll.c b/io_uring/poll.c
index 0df5eca93b16..95e28f32b49c 100644
--- a/io_uring/poll.c
+++ b/io_uring/poll.c
@@ -74,8 +74,10 @@ static void io_poll_req_insert(struct io_kiocb *req)
{
struct io_ring_ctx *ctx = req->ctx;
struct hlist_head *list;
+ u32 index = hash_long(req->cqe.user_data, ctx->cancel_hash_bits);
- list = &ctx->cancel_hash[hash_long(req->cqe.user_data, ctx->cancel_hash_bits)];
+ req->hash_index = index;
+ list = &ctx->cancel_hash[index];
hlist_add_head(&req->hash_node, list);
}
--
2.25.1
next prev parent reply other threads:[~2022-06-06 6:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-06 6:57 [PATCH v2 0/3] cancel_hash per entry lock Hao Xu
2022-06-06 6:57 ` Hao Xu [this message]
2022-06-06 11:59 ` [PATCH 1/3] io_uring: add hash_index and its logic to track req in cancel_hash Pavel Begunkov
2022-06-06 13:47 ` Hao Xu
2022-06-06 6:57 ` [PATCH 2/3] io_uring: add an io_hash_bucket structure for smaller granularity lock Hao Xu
2022-06-06 11:55 ` Pavel Begunkov
2022-06-06 6:57 ` [PATCH 3/3] io_uring: switch cancel_hash to use per list spinlock Hao Xu
2022-06-06 7:06 ` [PATCH v2 0/3] cancel_hash per entry lock Hao Xu
2022-06-06 12:02 ` Pavel Begunkov
2022-06-06 12:09 ` Pavel Begunkov
2022-06-06 13:39 ` Hao Xu
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 \
[email protected] \
[email protected] \
[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