• P
    io_uring: Use submit info inlined into req · fc1a5d21
    Pavel Begunkov 提交于
    commit 50585b9a07367b92382c1e975265344daeba78cd upstream.
    
    Stack allocated struct sqe_submit is passed down to the submission path
    along with a request (a.k.a. struct io_kiocb), and will be copied into
    req->submit for async requests.
    
    As space for it is already allocated, fill req->submit in the first
    place instead of using on-stack one. As a result:
    
    1. sqe->submit is the only place for sqe_submit and is always valid,
    so we don't need to track which one to use.
    2. don't need to copy in case of async
    3. allows to simplify the code by not carrying it as an argument all
    the way down
    4. allows to reduce number of function arguments / potentially improve
    spilling
    
    The downside is that stack is most probably be cached, that's not true
    for just allocated memory for a request. Another concern is cache
    pollution. Though, a request would be touched and fetched along with
    req->submit at some point anyway, so shouldn't be a problem.
    Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
    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>
    fc1a5d21
io_uring.c 104.8 KB