1. Jun 23, 2023
  2. Jun 20, 2023
  3. Jun 12, 2023
    • Jens Axboe's avatar
      io_uring: wait interruptibly for request completions on exit · 4826c594
      Jens Axboe authored
      WHen the ring exits, cleanup is done and the final cancelation and
      waiting on completions is done by io_ring_exit_work. That function is
      invoked by kworker, which doesn't take any signals. Because of that, it
      doesn't really matter if we wait for completions in TASK_INTERRUPTIBLE
      or TASK_UNINTERRUPTIBLE state. However, it does matter to the hung task
      detection checker!
      
      Normally we expect cancelations and completions to happen rather
      quickly. Some test cases, however, will exit the ring and park the
      owning task stopped (eg via SIGSTOP). If the owning task needs to run
      task_work to complete requests, then io_ring_exit_work won't make any
      progress until the task is runnable again. Hence io_ring_exit_work can
      trigger the hung task detection, which is particularly problematic if
      panic-on-hung-task is enabled.
      
      As the ring exit doesn't take signals to begin with, have it wait
      interruptibly rather than uninterruptibly. io_uring has a separate
      stuck-exit warning that triggers independently anyway, so we're not
      really missing anything by making this switch.
      
      Cc: stable@vger.kernel.org # 5.10+
      Link: https://lore.kernel.org/r/b0e4aaef-7088-56ce-244c-976edeac0e66@kernel.dk
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      4826c594
  4. Jun 08, 2023
  5. Jun 02, 2023
  6. May 25, 2023
  7. May 20, 2023
    • Pavel Begunkov's avatar
      io_uring: annotate offset timeout races · 5498bf28
      Pavel Begunkov authored
      
      
      It's racy to read ->cached_cq_tail without taking proper measures
      (usually grabbing ->completion_lock) as timeout requests with CQE
      offsets do, however they have never had a good semantics for from
      when they start counting. Annotate racy reads with data_race().
      
      Reported-by: default avatar <syzbot+cb265db2f3f3468ef436@syzkaller.appspotmail.com>
      Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
      Link: https://lore.kernel.org/r/4de3685e185832a92a572df2be2c735d2e21a83d.1684506056.git.asml.silence@gmail.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      5498bf28
    • Jens Axboe's avatar
      io_uring: maintain ordering for DEFER_TASKRUN tw list · 3af0356c
      Jens Axboe authored
      
      
      We use lockless lists for the local and deferred task_work, which means
      that when we queue up events for processing, we ultimately process them
      in reverse order to how they were received. This usually doesn't matter,
      but for some cases, it does seem to make a big difference. Do the right
      thing and reverse the list before processing it, so that we know it's
      processed in the same order in which it was received.
      
      This makes a rather big difference for some medium load network tests,
      where consistency of performance was a bit all over the place. Here's
      a case that has 4 connections each doing two sends and receives:
      
      io_uring port=10002: rps:161.13k Bps:  1.45M idle=256ms
      io_uring port=10002: rps:107.27k Bps:  0.97M idle=413ms
      io_uring port=10002: rps:136.98k Bps:  1.23M idle=321ms
      io_uring port=10002: rps:155.58k Bps:  1.40M idle=268ms
      
      and after the change:
      
      io_uring port=10002: rps:205.48k Bps:  1.85M idle=140ms user=40ms
      io_uring port=10002: rps:203.57k Bps:  1.83M idle=139ms user=20ms
      io_uring port=10002: rps:218.79k Bps:  1.97M idle=106ms user=30ms
      io_uring port=10002: rps:217.88k Bps:  1.96M idle=110ms user=20ms
      io_uring port=10002: rps:222.31k Bps:  2.00M idle=101ms user=0ms
      io_uring port=10002: rps:218.74k Bps:  1.97M idle=102ms user=20ms
      io_uring port=10002: rps:208.43k Bps:  1.88M idle=125ms user=40ms
      
      using more of the time to actually process work rather than sitting
      idle.
      
      No effects have been observed at the peak end of the spectrum, where
      performance is still the same even with deep batch depths (and hence
      more items to sort).
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      3af0356c
  8. May 18, 2023
  9. May 16, 2023
  10. May 15, 2023