Skip to content

Commit 007301c

Browse files
committed
Merge tag 'io_uring-5.16-2021-11-09' of git://git.kernel.dk/linux-block
Pull io_uring fixes from Jens Axboe: "Minor fixes that should go into the 5.16 release: - Fix max worker setting not working correctly on NUMA (Beld) - Correctly return current setting for max workers if zeroes are passed in (Pavel) - io_queue_sqe_arm_apoll() cleanup, as identified during the initial merge (Pavel) - Misc fixes (Nghia, me)" * tag 'io_uring-5.16-2021-11-09' of git://git.kernel.dk/linux-block: io_uring: honour zeroes as io-wq worker limits io_uring: remove dead 'sqe' store io_uring: remove redundant assignment to ret in io_register_iowq_max_workers() io-wq: fix max-workers not correctly set on multi-node system io_uring: clean up io_queue_sqe_arm_apoll
2 parents c183e17 + bad119b commit 007301c

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

fs/io-wq.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,9 @@ int io_wq_cpu_affinity(struct io_wq *wq, cpumask_var_t mask)
13081308
*/
13091309
int io_wq_max_workers(struct io_wq *wq, int *new_count)
13101310
{
1311-
int i, node, prev = 0;
1311+
int prev[IO_WQ_ACCT_NR];
1312+
bool first_node = true;
1313+
int i, node;
13121314

13131315
BUILD_BUG_ON((int) IO_WQ_ACCT_BOUND != (int) IO_WQ_BOUND);
13141316
BUILD_BUG_ON((int) IO_WQ_ACCT_UNBOUND != (int) IO_WQ_UNBOUND);
@@ -1319,6 +1321,9 @@ int io_wq_max_workers(struct io_wq *wq, int *new_count)
13191321
new_count[i] = task_rlimit(current, RLIMIT_NPROC);
13201322
}
13211323

1324+
for (i = 0; i < IO_WQ_ACCT_NR; i++)
1325+
prev[i] = 0;
1326+
13221327
rcu_read_lock();
13231328
for_each_node(node) {
13241329
struct io_wqe *wqe = wq->wqes[node];
@@ -1327,14 +1332,19 @@ int io_wq_max_workers(struct io_wq *wq, int *new_count)
13271332
raw_spin_lock(&wqe->lock);
13281333
for (i = 0; i < IO_WQ_ACCT_NR; i++) {
13291334
acct = &wqe->acct[i];
1330-
prev = max_t(int, acct->max_workers, prev);
1335+
if (first_node)
1336+
prev[i] = max_t(int, acct->max_workers, prev[i]);
13311337
if (new_count[i])
13321338
acct->max_workers = new_count[i];
1333-
new_count[i] = prev;
13341339
}
13351340
raw_spin_unlock(&wqe->lock);
1341+
first_node = false;
13361342
}
13371343
rcu_read_unlock();
1344+
1345+
for (i = 0; i < IO_WQ_ACCT_NR; i++)
1346+
new_count[i] = prev[i];
1347+
13381348
return 0;
13391349
}
13401350

fs/io_uring.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6950,10 +6950,6 @@ static void io_queue_sqe_arm_apoll(struct io_kiocb *req)
69506950

69516951
switch (io_arm_poll_handler(req)) {
69526952
case IO_APOLL_READY:
6953-
if (linked_timeout) {
6954-
io_queue_linked_timeout(linked_timeout);
6955-
linked_timeout = NULL;
6956-
}
69576953
io_req_task_queue(req);
69586954
break;
69596955
case IO_APOLL_ABORTED:
@@ -10144,7 +10140,7 @@ static __cold void __io_uring_show_fdinfo(struct io_ring_ctx *ctx,
1014410140
for (i = 0; i < sq_entries; i++) {
1014510141
unsigned int entry = i + sq_head;
1014610142
unsigned int sq_idx = READ_ONCE(ctx->sq_array[entry & sq_mask]);
10147-
struct io_uring_sqe *sqe = &ctx->sq_sqes[sq_idx];
10143+
struct io_uring_sqe *sqe;
1014810144

1014910145
if (sq_idx > sq_mask)
1015010146
continue;
@@ -10795,10 +10791,11 @@ static __cold int io_register_iowq_max_workers(struct io_ring_ctx *ctx,
1079510791

1079610792
BUILD_BUG_ON(sizeof(new_count) != sizeof(ctx->iowq_limits));
1079710793

10798-
memcpy(ctx->iowq_limits, new_count, sizeof(new_count));
10794+
for (i = 0; i < ARRAY_SIZE(new_count); i++)
10795+
if (new_count[i])
10796+
ctx->iowq_limits[i] = new_count[i];
1079910797
ctx->iowq_limits_set = true;
1080010798

10801-
ret = -EINVAL;
1080210799
if (tctx && tctx->io_wq) {
1080310800
ret = io_wq_max_workers(tctx->io_wq, new_count);
1080410801
if (ret)

0 commit comments

Comments
 (0)