a10 icon indicating copy to clipboard operation
a10 copied to clipboard

Use 32 bit pointer for SubmissionQueue to shrink AsyncFd

Open Thomasdezeeuw opened this issue 4 months ago • 0 comments

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.

Thomasdezeeuw avatar Apr 13 '24 10:04 Thomasdezeeuw