Commit 2bc4ca9b authored by Jens Axboe's avatar Jens Axboe

aio: don't zero entire aio_kiocb aio_get_req()

It's 192 bytes, fairly substantial. Most items don't need to be cleared,
especially not upfront. Clear the ones we do need to clear, and leave
the other ones for setup when the iocb is prepared and submitted.
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 432c7997
...@@ -1010,14 +1010,15 @@ static inline struct aio_kiocb *aio_get_req(struct kioctx *ctx) ...@@ -1010,14 +1010,15 @@ static inline struct aio_kiocb *aio_get_req(struct kioctx *ctx)
{ {
struct aio_kiocb *req; struct aio_kiocb *req;
req = kmem_cache_alloc(kiocb_cachep, GFP_KERNEL|__GFP_ZERO); req = kmem_cache_alloc(kiocb_cachep, GFP_KERNEL);
if (unlikely(!req)) if (unlikely(!req))
return NULL; return NULL;
percpu_ref_get(&ctx->reqs); percpu_ref_get(&ctx->reqs);
req->ki_ctx = ctx;
INIT_LIST_HEAD(&req->ki_list); INIT_LIST_HEAD(&req->ki_list);
refcount_set(&req->ki_refcnt, 0); refcount_set(&req->ki_refcnt, 0);
req->ki_ctx = ctx; req->ki_eventfd = NULL;
return req; return req;
} }
...@@ -1732,6 +1733,10 @@ static ssize_t aio_poll(struct aio_kiocb *aiocb, struct iocb *iocb) ...@@ -1732,6 +1733,10 @@ static ssize_t aio_poll(struct aio_kiocb *aiocb, struct iocb *iocb)
if (unlikely(!req->file)) if (unlikely(!req->file))
return -EBADF; return -EBADF;
req->head = NULL;
req->woken = false;
req->cancelled = false;
apt.pt._qproc = aio_poll_queue_proc; apt.pt._qproc = aio_poll_queue_proc;
apt.pt._key = req->events; apt.pt._key = req->events;
apt.iocb = aiocb; apt.iocb = aiocb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment