@@ -779,6 +779,26 @@ void io_wq_worker_sleeping(struct task_struct *tsk)
io_wqe_dec_running(worker);
}
+static void io_init_new_fixed_worker(struct io_wqe *wqe,
+ struct io_worker *worker)
+{
+ struct io_wqe_acct *acct = io_wqe_get_acct(worker);
+ struct io_wqe_acct *iw_acct = &worker->acct;
+ unsigned index = acct->index;
+ unsigned *nr_fixed;
+
+ raw_spin_lock(&acct->lock);
+ nr_fixed = &acct->nr_fixed;
+ acct->fixed_workers[*nr_fixed] = worker;
+ worker->index = (*nr_fixed)++;
+ iw_acct->nr_works = 0;
+ iw_acct->max_works = acct->max_works;
+ iw_acct->index = index;
+ INIT_WQ_LIST(&iw_acct->work_list);
+ raw_spin_lock_init(&iw_acct->lock);
+ raw_spin_unlock(&acct->lock);
+}
+
static void io_init_new_worker(struct io_wqe *wqe, struct io_worker *worker,
struct task_struct *tsk)
{
@@ -792,6 +812,8 @@ static void io_init_new_worker(struct io_wqe *wqe, struct io_worker *worker,
list_add_tail_rcu(&worker->all_list, &wqe->all_list);
worker->flags |= IO_WORKER_F_FREE;
raw_spin_unlock(&wqe->lock);
+ if (worker->flags & IO_WORKER_F_FIXED)
+ io_init_new_fixed_worker(wqe, worker);
wake_up_new_task(tsk);
}
@@ -898,6 +920,8 @@ static bool create_io_worker(struct io_wq *wq, struct io_wqe *wqe,
if (index == IO_WQ_ACCT_BOUND)
worker->flags |= IO_WORKER_F_BOUND;
+ if (&wqe->fixed_acct[index] == acct)
+ worker->flags |= IO_WORKER_F_FIXED;
tsk = create_io_thread(io_wqe_worker, worker, wqe->node);
if (!IS_ERR(tsk)) {