a10
a10 copied to clipboard
Use 32 bit pointer for SubmissionQueue to shrink AsyncFd
At the time of writing the AsyncFd
is an fd and a SubmissionQueue
. An fd is 4 bytes (i32
) and SubmissionQueue
is an Arc<SharedSubmissionQueue>
, so a pointer of 8 bytes (assuming 64 bit architecture). With padding this means AsyncFd
is 16 bytes (4 + 8
+ 4
bytes of padding), or four times larger than just a file descriptor.
If we can compress the 8 byte pointer to 4 bytes than the size of AsyncFd
would only be 8 bytes (4 + 4
), or half of it's current size. We can mmap(2)
the memory using MAP_32BIT
to ensure the OS gives us a 32 bit pointer. It does likely mean we can't use an Arc
any more and we'll have to do the reference counting ourselves.