On 7/13/20 2:03 AM, Pavel Begunkov wrote: > On 12/07/2020 23:29, Jens Axboe wrote: >> On 7/12/20 11:42 AM, Pavel Begunkov wrote: >>> io_kiocb::task_work was de-unionised, and is not planned to be shared >>> back, because it's too useful and commonly used. Hence, instead of >>> keeping a separate task_work in struct io_async_rw just reuse >>> req->task_work. >> >> This is a good idea, req->task_work is a first class citizen these days. >> Unfortunately it doesn't do much good for io_async_ctx, since it's so >> huge with the msghdr related bits. It'd be nice to do something about >> that too, though not a huge priority as allocating async context is > > We can allocate not an entire struct/union io_async_ctx but its particular > member. Should be a bit better for writes. Right, we probably just need to turn req->io into a: void *async_ctx; and have it be assigned with the various types that are needed for async deferral. > And if we can save another 16B in io_async_rw, it'd be 3 cachelines for > io_async_rw. E.g. there are two 4B holes in struct wait_page_queue, one is > from "int bit_nr", the second is inside "wait_queue_entry_t wait". An easy 8 bytes is just turning nr_segs and size into 32-bit types. The size will never be more than 2G, and segs is limited at 1k iirc. -- Jens Axboe