liburing: performance degradation starting from 5.7.16

Hi Jens,

I noticed that there is serious performance regression using sockets with io_uring starting from v5.7.16. Unfortunately, it continues into 5.8 and 5.9 I have not checked yet for which patch versions exactly.

perf top shows exactly where the contention happens but I can not identify the root-cause. I am not sure if it’s directly related to io_uring or some other change that caused the regression.

5.7.15 and earlier does not inhibit such contention for the same machine (18 physical cores). I am testing on Ubuntu 20.04 patched with prebuilt kernels from https://kernel.ubuntu.com/~kernel-ppa/mainline/

For 5.7.15 my benchmark achieves 1.6M qps and system cpu is at ~80%. for 5.7.16 or later it achieves only 1M qps and the system cpu is is at ~100% .

   57.66%  [kernel]       [k] native_queued_spin_lock_slowpath
     1.09%  [kernel]       [k] _raw_spin_lock_irqsave
     1.05%  [kernel]       [k] _raw_spin_lock
     0.83%  [kernel]       [k] tcp_recvmsg
     0.74%  [kernel]       [k] skb_release_data
     0.69%  [kernel]       [k] ena_start_xmit
     0.69%  [kernel]       [k] memset_erms
     0.69%  [kernel]       [k] __slab_free
     0.63%  [kernel]       [k] mwait_idle_with_hints.constprop.0
     0.56%  [kernel]       [k] copy_user_generic_unrolle
     0.49%  [kernel]       [k] ena_clean_tx_irq
     0.45%  [kernel]       [k] read_tsc

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 26 (25 by maintainers)

Commits related to this issue

Most upvoted comments

You bet, I’ll use that email. Once we have a final and you’ve vetted it, would be great if I could also add your Tested-by in there.

Ok, checked the latest fix c6a44403af72ba7788b82ee83bd53ff972923117 and I confirm that the performance issue is solved! Ping server reaches 2.7M qps run on 72 vcpus and saturate networking capacity way before overloading the cpu.

Great job!

P.S. Please backport the fix to 5.8 for the upcoming Ubuntu release.

Screenshot from 2020-10-01 10-31-47

Screenshot from 2020-10-01 10-30-47

Can you just document the exact flow as invalid/unsupported? It sounds like a deadlock what you are describing.

Btw, I use eventfd polling to wake io_uring loop from other threads and it works very well so i guess it applies to very specific use-case of eventfd. Or maybe you mean - eventfd generated by io_uring completions?

On Mon, Sep 28, 2020, 18:36 Jens Axboe notifications@github.com wrote:

I ran your test case this morning, and I agree it does cause a slowdown. It’s somewhat annoying, as 99.9% of use cases don’t need this, and the reasons are pretty complicated. Basically you only need this for some eventfd related setups, where the same application that does the IO also ends up blocking in the kernel waiting on the eventfd. The eventfd will trigger when completions are run, but some completions are not run until the application exits that loop and processes completions.

One idea would be to pass in a flag for io_uring setup that says “I do weird stuff with eventfd, use the safe/slower path” and default to NOT doing this. Don’t necessarily like that approach, but right now I can’t think of a better way to handle this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/axboe/liburing/issues/215#issuecomment-700098366, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4BFCCHMARHEMGCKUTGEBLSICUORANCNFSM4R32LOTQ .