• Marko Mäkelä's avatar
    MDEV-24883 add io_uring support for tpool · 783625d7
    Marko Mäkelä authored
    liburing is a new optional dependency (WITH_URING=auto|yes|no)
    that replaces libaio when it is available.
    
    aio_uring: class which wraps io_uring stuff
    
    aio_uring::bind()/unbind(): optional optimization
    
    aio_uring::submit_io(): mutex prevents data race. liburing calls are
    thread-unsafe. But if you look into it's implementation you'll see
    atomic operations. They're used for synchronization between kernel and
    user-space only. That's why our own synchronization is still needed.
    
    For systemd, we add LimitMEMLOCK=524288 (ulimit -l 524288)
    because the io_uring_setup system call that is invoked
    by io_uring_queue_init() requests locked memory. The value
    was found empirically; with 262144, we would occasionally
    fail to enable io_uring when using the maximum values of
    innodb_read_io_threads=64 and innodb_write_io_threads=64.
    
    aio_uring::thread_routine(): Tolerate -EINTR return from
    io_uring_wait_cqe(), because it may occur on shutdown
    on Ubuntu 20.10 (Groovy Gorilla).
    
    This was mostly implemented by Eugene Kosov. Systemd integration
    and improved startup/shutdown error handling by Marko Mäkelä.
    783625d7
tpool.h 6.68 KB