mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-23 04:54:01 +08:00
io_uring: stop using io_wq_work as an fd placeholder
There are two reasons why this isn't the best idea:
- It's an odd area to grab a bit of storage space, hence it's an odd area
to grab storage from.
- It puts the 3rd io_kiocb cacheline into the hot path, where normal hot
path just needs the first two.
Use 'cflags' for joint fd/cflags storage. We only need fd until we
successfully issue, and we only need cflags once a request is done and is
completed.
Fixes: 6bf9c47a39
("io_uring: defer file assignment")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
2804ecd8d3
commit
82733d168c
@ -155,7 +155,6 @@ struct io_wq_work_node *wq_stack_extract(struct io_wq_work_node *stack)
|
|||||||
struct io_wq_work {
|
struct io_wq_work {
|
||||||
struct io_wq_work_node list;
|
struct io_wq_work_node list;
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
int fd;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct io_wq_work *wq_next_work(struct io_wq_work *work)
|
static inline struct io_wq_work *wq_next_work(struct io_wq_work *work)
|
||||||
|
@ -907,7 +907,11 @@ struct io_kiocb {
|
|||||||
|
|
||||||
u64 user_data;
|
u64 user_data;
|
||||||
u32 result;
|
u32 result;
|
||||||
u32 cflags;
|
/* fd initially, then cflags for completion */
|
||||||
|
union {
|
||||||
|
u32 cflags;
|
||||||
|
int fd;
|
||||||
|
};
|
||||||
|
|
||||||
struct io_ring_ctx *ctx;
|
struct io_ring_ctx *ctx;
|
||||||
struct task_struct *task;
|
struct task_struct *task;
|
||||||
@ -7090,9 +7094,9 @@ static bool io_assign_file(struct io_kiocb *req, unsigned int issue_flags)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (req->flags & REQ_F_FIXED_FILE)
|
if (req->flags & REQ_F_FIXED_FILE)
|
||||||
req->file = io_file_get_fixed(req, req->work.fd, issue_flags);
|
req->file = io_file_get_fixed(req, req->fd, issue_flags);
|
||||||
else
|
else
|
||||||
req->file = io_file_get_normal(req, req->work.fd);
|
req->file = io_file_get_normal(req, req->fd);
|
||||||
if (req->file)
|
if (req->file)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -7630,7 +7634,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
|
|||||||
if (io_op_defs[opcode].needs_file) {
|
if (io_op_defs[opcode].needs_file) {
|
||||||
struct io_submit_state *state = &ctx->submit_state;
|
struct io_submit_state *state = &ctx->submit_state;
|
||||||
|
|
||||||
req->work.fd = READ_ONCE(sqe->fd);
|
req->fd = READ_ONCE(sqe->fd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Plug now if we have more than 2 IO left after this, and the
|
* Plug now if we have more than 2 IO left after this, and the
|
||||||
|
Loading…
Reference in New Issue
Block a user