liburing: native_queued_spin_lock_slowpath contention even after #215 fix

A bit different scenario:

When using IOSQE_IO_LINK for chaining SQEs there is a contention bottleneck with native_queued_spin_lock_slowpath (see below).

I run it on the patched kernel from tif-task_work branch.

To reproduce - I used my own echo server: https://github.com/romange/async/blob/master/examples/echo_server.cc Binary (compiled on ubuntu 20.04): https://drive.google.com/file/d/1hgimzG2Y9Olf1cVVUGyssF2pgx1QiBJ3/view?usp=sharing

To run on server side: ./echo_server --logtostderr To run on client side: ./echo_server --connect <ip> -n 100000 -c 5

67.01% [kernel] [k] native_queued_spin_lock_slowpath 3.35% [kernel] [k] _raw_spin_lock 1.88% [kernel] [k] io_prep_async_work 1.01% [kernel] [k] io_dismantle_req 0.79% [ena] [k] ena_io_poll 0.61% [kernel] [k] fput_many 0.47% [kernel] [k] __io_free_req_finish 0.43% [kernel] [k] _copy_from_user 0.42% [ena] [k] ena_start_xmit 0.37% [kernel] [k] _raw_spin_lock_irq 0.36% [kernel] [k] irq_entries_start 0.30% [kernel] [k] copy_user_enhanced_fast_string 0.30% [kernel] [k] skb_release_data

PerfTop: 123479 irqs/sec kernel:91.4% exact: 0.0% lost: 0/0 drop: 0/0 [4000Hz cycles], (all, 36 CPUs)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 35 (21 by maintainers)

Most upvoted comments

Oh, I just noticed now - I’ve commented on the wrong issue. I meant to comment yesterday on #215 and not on this one. sorry for the confusion I caused.

To conclude, #218 is fixed in 5.10 and #215 is waiting for 5.11. And once 5.11 release window opens, Jens will try to cherry-pick the fix for #215 into 5.10.

@axboe, got it, thanks! It seems this would be the fastest way to fix the contention. I’ll cook it.

Not sure I see it somewhere disabled on the io_uring side, but it souds like we can remove needs_fs from SENDMSG/RECVMSG.

It’s done in __sys_sendmsg_sock():

/* disallow ancillary data requests from this path */
if (msg->msg_control || msg->msg_controllen)
        return -EINVAL;

So yes, it can be removed in io_uring, just needs a comment on why.