io_uring: reduce/pack size of io_ring_ctx
authorJens Axboe <axboe@kernel.dk>
Fri, 8 Nov 2019 01:27:42 +0000 (18:27 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 11 Nov 2019 03:29:49 +0000 (20:29 -0700)
commit206aefde4f886fdeb3b6339aacab3a85fb74cb7e
treec4aa3295817662bca2ed4d8dce9eb04986a959b4
parent5f8fd2d3e0a7aa7fc9d97226be24286edd289835
io_uring: reduce/pack size of io_ring_ctx

With the recent flurry of additions and changes to io_uring, the
layout of io_ring_ctx has become a bit stale. We're right now at
704 bytes in size on my x86-64 build, or 11 cachelines. This
patch does two things:

- We have to completion structs embedded, that we only use for
  quiesce of the ctx (or shutdown) and for sqthread init cases.
  That 2x32 bytes right there, let's dynamically allocate them.

- Reorder the struct a bit with an eye on cachelines, use cases,
  and holes.

With this patch, we're down to 512 bytes, or 8 cachelines.

Reviewed-by: Jackie Liu <liuyun01@kylinos.cn>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c