summaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-08-03 09:14:35 -0600
committerJens Axboe <axboe@kernel.dk>2021-08-04 14:34:46 -0600
commit83d6c39310b6d11199179f6384c2b0a415389597 (patch)
treedbac16c10fdb5b4e5a80b248b12ad4f76a5fc75b /net/xfrm
parenta890d01e4ee016978776e45340e521b3bbbdf41f (diff)
downloadlinux-83d6c39310b6d11199179f6384c2b0a415389597.tar.bz2
io-wq: fix race between worker exiting and activating free worker
Nadav correctly reports that we have a race between a worker exiting, and new work being queued. This can lead to work being queued behind an existing worker that could be sleeping on an event before it can run to completion, and hence introducing potential big latency gaps if we hit this race condition: cpu0 cpu1 ---- ---- io_wqe_worker() schedule_timeout() // timed out io_wqe_enqueue() io_wqe_wake_worker() // work_flags & IO_WQ_WORK_CONCURRENT io_wqe_activate_free_worker() io_worker_exit() Fix this by having the exiting worker go through the normal decrement of a running worker, which will spawn a new one if needed. The free worker activation is modified to only return success if we were able to find a sleeping worker - if not, we keep looking through the list. If we fail, we create a new worker as per usual. Cc: stable@vger.kernel.org Link: https://lore.kernel.org/io-uring/BFF746C0-FEDE-4646-A253-3021C57C26C9@gmail.com/ Reported-by: Nadav Amit <nadav.amit@gmail.com> Tested-by: Nadav Amit <nadav.amit@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'net/xfrm')
0 files changed, 0 insertions, 0 deletions