mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
ebdfefc09c
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: fe76421d1d
("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>
30 lines
830 B
C
30 lines
830 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
struct io_sq_data {
|
|
refcount_t refs;
|
|
atomic_t park_pending;
|
|
struct mutex lock;
|
|
|
|
/* ctx's that are using this sqd */
|
|
struct list_head ctx_list;
|
|
|
|
struct task_struct *thread;
|
|
struct wait_queue_head wait;
|
|
|
|
unsigned sq_thread_idle;
|
|
int sq_cpu;
|
|
pid_t task_pid;
|
|
pid_t task_tgid;
|
|
|
|
unsigned long state;
|
|
struct completion exited;
|
|
};
|
|
|
|
int io_sq_offload_create(struct io_ring_ctx *ctx, struct io_uring_params *p);
|
|
void io_sq_thread_finish(struct io_ring_ctx *ctx);
|
|
void io_sq_thread_stop(struct io_sq_data *sqd);
|
|
void io_sq_thread_park(struct io_sq_data *sqd);
|
|
void io_sq_thread_unpark(struct io_sq_data *sqd);
|
|
void io_put_sq_data(struct io_sq_data *sqd);
|
|
void io_sqpoll_wait_sq(struct io_ring_ctx *ctx);
|
|
int io_sqpoll_wq_cpu_affinity(struct io_ring_ctx *ctx, cpumask_var_t mask);
|