• J
    io_uring: provide fallback request for OOM situations · 687d02d6
    Jens Axboe 提交于
    commit 0ddf92e848ab7abf216f218ee363eb9b9650e98f upstream.
    
    One thing that really sucks for userspace APIs is if the kernel passes
    back -ENOMEM/-EAGAIN for resource shortages. The application really has
    no idea of what to do in those cases. Should it try and reap
    completions? Probably a good idea. Will it solve the issue? Who knows.
    
    This patch adds a simple fallback mechanism if we fail to allocate
    memory for a request. If we fail allocating memory from the slab for a
    request, we punt to a pre-allocated request. There's just one of these
    per io_ring_ctx, but the important part is if we ever return -EBUSY to
    the application, the applications knows that it can wait for events and
    make forward progress when events have completed. This is the important
    part.
    Signed-off-by: NJens Axboe <axboe@kernel.dk>
    Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
    Reviewed-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
    687d02d6
io_uring.c 112.2 KB