diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2021-04-11 01:46:38 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-04-12 09:33:04 -0600 |
commit | 88885f66e8c66311923c16caf1ccb6415ebfef72 (patch) | |
tree | d53bd24884001e23296fff656e9f217433485a6e /fs/io_uring.c | |
parent | aeca241b0bdd831ad5706605f5e09b44fe940220 (diff) | |
download | lwn-88885f66e8c66311923c16caf1ccb6415ebfef72.tar.gz lwn-88885f66e8c66311923c16caf1ccb6415ebfef72.zip |
io_uring: improve sqo stop
Set IO_SQ_THREAD_SHOULD_STOP before taking sqd lock, so the sqpoll task
sees earlier. Not a problem, it will stop eventually. Also check
invariant that it's stopped only once.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/653b24ee93843a50ff65a45847d9138f5adb76d7.1618101759.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 880c7743ab09..7f2590c5d194 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -7229,9 +7229,10 @@ static void io_sq_thread_park(struct io_sq_data *sqd) static void io_sq_thread_stop(struct io_sq_data *sqd) { WARN_ON_ONCE(sqd->thread == current); + WARN_ON_ONCE(test_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state)); - mutex_lock(&sqd->lock); set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state); + mutex_lock(&sqd->lock); if (sqd->thread) wake_up_process(sqd->thread); mutex_unlock(&sqd->lock); |