diff options
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index ac0407693834..67d1aae349d7 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c | |||
@@ -231,7 +231,6 @@ struct io_ring_ctx { | |||
231 | struct task_struct *sqo_thread; /* if using sq thread polling */ | 231 | struct task_struct *sqo_thread; /* if using sq thread polling */ |
232 | struct mm_struct *sqo_mm; | 232 | struct mm_struct *sqo_mm; |
233 | wait_queue_head_t sqo_wait; | 233 | wait_queue_head_t sqo_wait; |
234 | unsigned sqo_stop; | ||
235 | 234 | ||
236 | struct { | 235 | struct { |
237 | /* CQ ring */ | 236 | /* CQ ring */ |
@@ -2015,7 +2014,7 @@ static int io_sq_thread(void *data) | |||
2015 | set_fs(USER_DS); | 2014 | set_fs(USER_DS); |
2016 | 2015 | ||
2017 | timeout = inflight = 0; | 2016 | timeout = inflight = 0; |
2018 | while (!kthread_should_stop() && !ctx->sqo_stop) { | 2017 | while (!kthread_should_park()) { |
2019 | bool all_fixed, mm_fault = false; | 2018 | bool all_fixed, mm_fault = false; |
2020 | int i; | 2019 | int i; |
2021 | 2020 | ||
@@ -2077,7 +2076,7 @@ static int io_sq_thread(void *data) | |||
2077 | smp_mb(); | 2076 | smp_mb(); |
2078 | 2077 | ||
2079 | if (!io_get_sqring(ctx, &sqes[0])) { | 2078 | if (!io_get_sqring(ctx, &sqes[0])) { |
2080 | if (kthread_should_stop()) { | 2079 | if (kthread_should_park()) { |
2081 | finish_wait(&ctx->sqo_wait, &wait); | 2080 | finish_wait(&ctx->sqo_wait, &wait); |
2082 | break; | 2081 | break; |
2083 | } | 2082 | } |
@@ -2127,8 +2126,7 @@ static int io_sq_thread(void *data) | |||
2127 | mmput(cur_mm); | 2126 | mmput(cur_mm); |
2128 | } | 2127 | } |
2129 | 2128 | ||
2130 | if (kthread_should_park()) | 2129 | kthread_parkme(); |
2131 | kthread_parkme(); | ||
2132 | 2130 | ||
2133 | return 0; | 2131 | return 0; |
2134 | } | 2132 | } |
@@ -2260,8 +2258,11 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx) | |||
2260 | static void io_sq_thread_stop(struct io_ring_ctx *ctx) | 2258 | static void io_sq_thread_stop(struct io_ring_ctx *ctx) |
2261 | { | 2259 | { |
2262 | if (ctx->sqo_thread) { | 2260 | if (ctx->sqo_thread) { |
2263 | ctx->sqo_stop = 1; | 2261 | /* |
2264 | mb(); | 2262 | * The park is a bit of a work-around, without it we get |
2263 | * warning spews on shutdown with SQPOLL set and affinity | ||
2264 | * set to a single CPU. | ||
2265 | */ | ||
2265 | kthread_park(ctx->sqo_thread); | 2266 | kthread_park(ctx->sqo_thread); |
2266 | kthread_stop(ctx->sqo_thread); | 2267 | kthread_stop(ctx->sqo_thread); |
2267 | ctx->sqo_thread = NULL; | 2268 | ctx->sqo_thread = NULL; |