• Marko Mäkelä's avatar
    MDEV-24270 Misuse of io_getevents() causes wake-ups at least twice per second · 7a9405e3
    Marko Mäkelä authored
    In the asynchronous I/O interface, InnoDB is invoking io_getevents()
    with a timeout value of half a second, and requesting exactly 1 event
    at a time.
    
    The reason to have such a short timeout is to facilitate shutdown.
    
    We can do better: Use an infinite timeout, wait for a larger maximum
    number of events. On shutdown, we will invoke io_destroy(), which
    should lead to the io_getevents system call reporting EINVAL.
    
    my_getevents(): Reimplement the libaio io_getevents() by only invoking
    the system call. The library implementation would try to elide the
    system call and return 0 immediately if aio_ring_is_empty() holds.
    Here, we do want a blocking system call, not 100% CPU usage. Neither
    do we want the aio_ring_is_empty() trigger SIGSEGV because it is
    dereferencing some memory that was freed by io_destroy().
    7a9405e3
aio_linux.cc 3.96 KB