]> git.baikalelectronics.ru Git - kernel.git/commitdiff
io_uring: comment on kfree(iovec) checks
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 20 Aug 2020 08:34:10 +0000 (11:34 +0300)
committerJens Axboe <axboe@kernel.dk>
Thu, 20 Aug 2020 11:36:17 +0000 (05:36 -0600)
kfree() handles NULL pointers well, but io_{read,write}() checks it
because of performance reasons. Leave a comment there for those who are
tempted to patch it.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index d43a20a554e4c1bd609b8e948dcaa79d71dd4349..b9ca5a54dc204003c82e56a2b0d5197feeb78bd4 100644 (file)
@@ -3204,6 +3204,7 @@ done:
        kiocb_done(kiocb, ret, cs);
        ret = 0;
 out_free:
+       /* it's reportedly faster than delegating the null check to kfree() */
        if (iovec)
                kfree(iovec);
        return ret;
@@ -3300,6 +3301,7 @@ copy_iov:
                        return -EAGAIN;
        }
 out_free:
+       /* it's reportedly faster than delegating the null check to kfree() */
        if (iovec)
                kfree(iovec);
        return ret;