diff options
| -rw-r--r-- | fs/io_uring.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index e5008c1b82be..24355e0c47f0 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c | |||
| @@ -2241,10 +2241,6 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx, | |||
| 2241 | mmgrab(current->mm); | 2241 | mmgrab(current->mm); |
| 2242 | ctx->sqo_mm = current->mm; | 2242 | ctx->sqo_mm = current->mm; |
| 2243 | 2243 | ||
| 2244 | ctx->sq_thread_idle = msecs_to_jiffies(p->sq_thread_idle); | ||
| 2245 | if (!ctx->sq_thread_idle) | ||
| 2246 | ctx->sq_thread_idle = HZ; | ||
| 2247 | |||
| 2248 | ret = -EINVAL; | 2244 | ret = -EINVAL; |
| 2249 | if (!cpu_possible(p->sq_thread_cpu)) | 2245 | if (!cpu_possible(p->sq_thread_cpu)) |
| 2250 | goto err; | 2246 | goto err; |
| @@ -2254,10 +2250,18 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx, | |||
| 2254 | if (!capable(CAP_SYS_ADMIN)) | 2250 | if (!capable(CAP_SYS_ADMIN)) |
| 2255 | goto err; | 2251 | goto err; |
| 2256 | 2252 | ||
| 2253 | ctx->sq_thread_idle = msecs_to_jiffies(p->sq_thread_idle); | ||
| 2254 | if (!ctx->sq_thread_idle) | ||
| 2255 | ctx->sq_thread_idle = HZ; | ||
| 2256 | |||
| 2257 | if (p->flags & IORING_SETUP_SQ_AFF) { | 2257 | if (p->flags & IORING_SETUP_SQ_AFF) { |
| 2258 | int cpu; | 2258 | int cpu; |
| 2259 | 2259 | ||
| 2260 | cpu = array_index_nospec(p->sq_thread_cpu, NR_CPUS); | 2260 | cpu = array_index_nospec(p->sq_thread_cpu, NR_CPUS); |
| 2261 | ret = -EINVAL; | ||
| 2262 | if (!cpu_possible(p->sq_thread_cpu)) | ||
| 2263 | goto err; | ||
| 2264 | |||
| 2261 | ctx->sqo_thread = kthread_create_on_cpu(io_sq_thread, | 2265 | ctx->sqo_thread = kthread_create_on_cpu(io_sq_thread, |
| 2262 | ctx, cpu, | 2266 | ctx, cpu, |
| 2263 | "io_uring-sq"); | 2267 | "io_uring-sq"); |
