Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add posixaio_waitcomplete engine. #1266

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

macdice
Copy link
Contributor

@macdice macdice commented Aug 22, 2021

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.

static struct io_u *
io_u_from_aiocb(struct aiocb *aiocb)
{
return (struct io_u *)((char *)aiocb - (offsetof(struct io_u, aiocb)));
Copy link
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
Copy link
Owner

axboe commented Aug 22, 2021

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
Copy link
Owner

axboe commented Aug 22, 2021

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
Copy link
Contributor Author

macdice commented Aug 22, 2021

(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
Copy link
Owner

axboe commented Aug 22, 2021 via email

@axboe
Copy link
Owner

axboe commented Aug 22, 2021

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
Copy link
Collaborator

sitsofe commented Dec 6, 2021

@macdice any follow up on this one?

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

macdice commented Dec 6, 2021

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 <[email protected]>
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 <[email protected]>
@macdice
Copy link
Contributor Author

macdice commented Dec 11, 2021

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