Skip to content

Add posixaio_waitcomplete engine.#1266

Open
macdice wants to merge 2 commits into
axboe:masterfrom
macdice:aio_waitcomplete
Open

Add posixaio_waitcomplete engine.#1266
macdice wants to merge 2 commits into
axboe:masterfrom
macdice:aio_waitcomplete

Conversation

@macdice

@macdice macdice commented Aug 22, 2021

Copy link
Copy Markdown
Contributor

Provide a variant of the posixaio engine that uses FreeBSD's
aio_waitcomplete() function to consume completions, instead of running
around polling all IOs with aio_error().

To preserve the traditional posixaio behaviour and for fair comparison
with it, it drains as many extra completions as it can without waiting.
To disable that and drain just the minimum number as some other engines
do, there's a new option --posixaio-drain-min; this might keep the IO
queue depth more stable/full.

Comment thread engines/posixaio.c Outdated
static struct io_u *
io_u_from_aiocb(struct aiocb *aiocb)
{
return (struct io_u *)((char *)aiocb - (offsetof(struct io_u, aiocb)));

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

container_of()? That'd be way more readable ;-)

@axboe

axboe commented Aug 22, 2021

Copy link
Copy Markdown
Owner

Overall looks fine, just a few notes:

  1. Please update HOWTO/fio.1 with the new engine option
  2. Commit needs a Signed-off-by at the end with your name/email
  3. Use container_of(), that's much more readable. Just drop the io_u_from_aiocb() helper.
  4. Minor style issues noted

@axboe

axboe commented Aug 22, 2021

Copy link
Copy Markdown
Owner

Actually, the style issue I was going to mention goes away when you kill io_u_from_aiocb().

@macdice macdice force-pushed the aio_waitcomplete branch 2 times, most recently from bce7dd2 to b24866d Compare August 22, 2021 04:37
@macdice

macdice commented Aug 22, 2021

Copy link
Copy Markdown
Contributor Author

(Sorry for the force pushes, not too used to github workflow and didn't know that'd show up like that. :-))

Thanks for the feedback! I was writing up the docs and realised there is a better way to spin this: it's kinda sorta arguably a bug that posixaio doesn't respect iodepth_batch_complete_max. Let's just make posixaio_waitcomplete behave "normally", and add an option for posixaio that opts into a behaviour change to make it more like other engines. Hence, split into two commits. What do you think?

@axboe

axboe commented Aug 22, 2021 via email

Copy link
Copy Markdown
Owner

@axboe

axboe commented Aug 22, 2021

Copy link
Copy Markdown
Owner

Now on laptop and looking at it, I think the best approach is to just have this be an option for the posixaio engine, if the platform supports the waitcomplete mode. Don't think a an extra engine makes a lot of sense, even if they end up having two separate getevents implementations. Just have a parent one that picks the right one.

Provide an option for the posixaio engine that selects which mode to use, and just error if waitcomplete is specified and it isn't available.

It'd be nice to include some performance numbers from the commit enabling waitcomplete in the commit message.

@sitsofe

sitsofe commented Dec 6, 2021

Copy link
Copy Markdown
Collaborator

@macdice any follow up on this one?

@sitsofe sitsofe added the needreporterinfo Waiting on information from the issue reporter label Dec 6, 2021
@macdice

macdice commented Dec 6, 2021

Copy link
Copy Markdown
Contributor Author

Sorry for the delay: I will post a new patch this weekend coming, with an option as requested.

The posixaio engine prevously ignored iodepth_batch_complete_max and
polled the whole set of in flight IOs.  This might be a little confusing
when comparing with other engines.  Therefore, provide a new option
--posixaio_respect_iodepth_batch_complete_max.  Not enabled by default,
so as not to change any results unexpectedly.

Signed-off-by: Thomas Munro <thomas.munro@gmail.com>
Provide an option to use FreeBSD's aio_waitcomplete() function to wait
for completions, instead of aio_suspend().  Not enabled by default.

Signed-off-by: Thomas Munro <thomas.munro@gmail.com>
@macdice

macdice commented Dec 11, 2021

Copy link
Copy Markdown
Contributor Author

Done. Seems quite nice this way. BTW I plan to propose a couple more values for posixaio_wait, in later PRs (sigwaitinfo and kevent).

@sitsofe sitsofe removed the needreporterinfo Waiting on information from the issue reporter label Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants