io_uring/sqpoll: fix io-wq affinity when IORING_SETUP_SQPOLL is used
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 12 Sep 2023 13:57:07 +0000 (14:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Sep 2023 10:27:54 +0000 (12:27 +0200)
commit9704cfcf1fa9bd7b7a2e7d3adf892baa106d771d
tree6a05a2d4054c2cc106f3594183c60c57d60c04df
parent605d055452e7abed4aca012953aecc79c09baf12
io_uring/sqpoll: fix io-wq affinity when IORING_SETUP_SQPOLL is used

From: Jens Axboe <axboe@kernel.dk>

[ upstream commit ebdfefc09c6de7897962769bd3e63a2ff443ebf5 ]

If we setup the ring with SQPOLL, then that polling thread has its
own io-wq setup. This means that if the application uses
IORING_REGISTER_IOWQ_AFF to set the io-wq affinity, we should not be
setting it for the invoking task, but rather the sqpoll task.

Add an sqpoll helper that parks the thread and updates the affinity,
and use that one if we're using SQPOLL.

Fixes: fe76421d1da1 ("io_uring: allow user configurable IO thread CPU affinity")
Cc: stable@vger.kernel.org # 5.10+
Link: https://github.com/axboe/liburing/discussions/884
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
io_uring/io-wq.c
io_uring/io-wq.h
io_uring/io_uring.c
io_uring/sqpoll.c
io_uring/sqpoll.h