• X
    alinux: io_uring: add percpu io sq thread support · ef286499
    Xiaoguang Wang 提交于
    task #26578122
    
    Currently we can create multiple io_uring instances which all have SQPOLL
    enabled and make them bound to same cpu core by setting sq_thread_cpu argument,
    but sometimes this isn't efficient. Imagine such extreme case, create two io
    uring instances, which both have SQPOLL enabled and are bound to same cpu core.
    One instance submits io per 500ms, another instance submits io continually,
    then obviously the 1st instance still always contend for cpu resource, which
    will impact 2nd instance.
    
    To fix this issue, add a new flag IORING_SETUP_SQPOLL_PERCPU, when both
    IORING_SETUP_SQ_AFF and IORING_SETUP_SQPOLL_PERCPU are enabled, we create a
    percpu io sq_thread to handle multiple io_uring instances' io requests with
    round-robin strategy, the improvements are very big, see below:
    
    IOPS:
      No of instances       1     2     4     8     16     32
      kernel unpatched   589k  487k  303k  165k  85.8k  43.7k
      kernel patched     590k  593k  581k  538k   494k   406k
    
    LATENCY(us):
      No of instances       1     2     4     8     16     32
      kernel unpatched    217   262   422   775  1488    2917
      kernel patched      216   215   219   237   258     313
    
    Link: https://lore.kernel.org/io-uring/20200520115648.6140-1-xiaoguang.wang@linux.alibaba.com/Reviewed-by: NJiufei Xue <jiufei.xue@linux.alibaba.com>
    Reviewed-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
    Signed-off-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
    ef286499
io_uring.c 200.4 KB