forked from Minki/linux
io_uring: arm poll for non-nowait files
Don't check if we can do nowait before arming apoll, there are several reasons for that. First, we don't care much about files that don't support nowait. Second, it may be useful -- we don't want to be taking away extra workers from io-wq when it can go in some async. Even if it will go through io-wq eventually, it make difference in the numbers of workers actually used. And the last one, it's needed to clean nowait in future commits. [kernel test robot: fix unused-var] Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/9d06f3cb2c8b686d970269a87986f154edb83043.1634425438.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
b10841c98c
commit
e74ead135b
@ -5588,7 +5588,6 @@ static int io_arm_poll_handler(struct io_kiocb *req)
|
||||
struct async_poll *apoll;
|
||||
struct io_poll_table ipt;
|
||||
__poll_t ret, mask = EPOLLONESHOT | POLLERR | POLLPRI;
|
||||
int rw;
|
||||
|
||||
if (!req->file || !file_can_poll(req->file))
|
||||
return IO_APOLL_ABORTED;
|
||||
@ -5598,7 +5597,6 @@ static int io_arm_poll_handler(struct io_kiocb *req)
|
||||
return IO_APOLL_ABORTED;
|
||||
|
||||
if (def->pollin) {
|
||||
rw = READ;
|
||||
mask |= POLLIN | POLLRDNORM;
|
||||
|
||||
/* If reading from MSG_ERRQUEUE using recvmsg, ignore POLLIN */
|
||||
@ -5606,14 +5604,9 @@ static int io_arm_poll_handler(struct io_kiocb *req)
|
||||
(req->sr_msg.msg_flags & MSG_ERRQUEUE))
|
||||
mask &= ~POLLIN;
|
||||
} else {
|
||||
rw = WRITE;
|
||||
mask |= POLLOUT | POLLWRNORM;
|
||||
}
|
||||
|
||||
/* if we can't nonblock try, then no point in arming a poll handler */
|
||||
if (!io_file_supports_nowait(req, rw))
|
||||
return IO_APOLL_ABORTED;
|
||||
|
||||
apoll = kmalloc(sizeof(*apoll), GFP_ATOMIC);
|
||||
if (unlikely(!apoll))
|
||||
return IO_APOLL_ABORTED;
|
||||
|
Loading…
Reference in New Issue
Block a user