Skip to content

Commit 2bc4ca9

Browse files
committed
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: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 432c799 commit 2bc4ca9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fs/aio.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,14 +1010,15 @@ static inline struct aio_kiocb *aio_get_req(struct kioctx *ctx)
10101010
{
10111011
struct aio_kiocb *req;
10121012

1013-
req = kmem_cache_alloc(kiocb_cachep, GFP_KERNEL|__GFP_ZERO);
1013+
req = kmem_cache_alloc(kiocb_cachep, GFP_KERNEL);
10141014
if (unlikely(!req))
10151015
return NULL;
10161016

10171017
percpu_ref_get(&ctx->reqs);
1018+
req->ki_ctx = ctx;
10181019
INIT_LIST_HEAD(&req->ki_list);
10191020
refcount_set(&req->ki_refcnt, 0);
1020-
req->ki_ctx = ctx;
1021+
req->ki_eventfd = NULL;
10211022
return req;
10221023
}
10231024

@@ -1732,6 +1733,10 @@ static ssize_t aio_poll(struct aio_kiocb *aiocb, struct iocb *iocb)
17321733
if (unlikely(!req->file))
17331734
return -EBADF;
17341735

1736+
req->head = NULL;
1737+
req->woken = false;
1738+
req->cancelled = false;
1739+
17351740
apt.pt._qproc = aio_poll_queue_proc;
17361741
apt.pt._key = req->events;
17371742
apt.iocb = aiocb;

0 commit comments

Comments
 (0)