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 support for RWF_NOWAIT into related engines #972

Merged
merged 1 commit into from
Jun 10, 2020
Merged

Conversation

koct9i
Copy link
Contributor

@koct9i koct9i commented Apr 27, 2020

No description provided.

Copy link
Collaborator

@sitsofe sitsofe left a comment

Choose a reason for hiding this comment

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

Minor documentation comment otherwise LGTM!

HOWTO Outdated
@@ -2096,6 +2096,10 @@ with the caveat that when used on the command line, they must come after the
When hipri is set this determines the probability of a pvsync2 I/O being high
priority. The default is 100%.

.. option:: nowait : [pvsync2] [libaio] [io_uring]

Set RWF_NOWAIT on I/O, do not wait if request cannot be executed immediately.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you mention what the default is? Is it also worth mentioning the user needs a 4.14 or later kernel?

Copy link
Owner

Choose a reason for hiding this comment

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

Agree on those suggestions. Would also probably prefer a single commit, since that single commit could then have an explanation of what it is. The commit messages seem a bit messed up right now, and are either empty (io_uring), or some implementation detail (aio), or no explanation of the feature (sync).

So either make the first one have a full explanation, with the other referencing it, or combine them into one commit instead and include the whole thing. Either approach is fine with me.

HOWTO Outdated
Also process could wait for various locks in the kernel.

With this option I/O has flag RWF_NOWAIT and ends instanyly with EAGAIN
instead of waiting for anything. Or returns partial result.
Copy link
Collaborator

Choose a reason for hiding this comment

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

"Or returns partial result." - I'm not sure this is clear. Are you saying using RWF_NOWAIT can return a partial result or are you saying it will return instantly without returning a partial result?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe this:

This option sets the RWF_NOWAIT flag (supported from the 4.14 Linux kernel) and the call will return instantly with EAGAIN or a partial result rather than waiting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, that's better.

HOWTO Outdated

By default if request cannot be executed immediately it is enqueued to
submit later or process blocks until required resouce becomes free.
Also process could wait for various locks in the kernel.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe:

By default if request cannot be executed immediately (e.g. resource starvation, waiting on locks) it is queued and the initiating process will be blocked until required the required resource becomes free.

HOWTO Outdated
For cached I/O this usually means request returns only cached data and
never issues any disk requests. Direct I/O issues request only if cache
invalidation isn't required, file blocks are allocated and disk request
could be issued immediately.
Copy link
Collaborator

Choose a reason for hiding this comment

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

For cached I/O, using this option usually means a request will only return cached data and

For Direct I/O, requests will only succeed if cache invalidation isn't required, file blocks are fully allocated and the disk request could be issued immediately.

(This text is very informative!)

HOWTO Outdated

Supported since Linux 4.14

Makes sense to use together with ignore_error=EAGAIN.
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is useful to also use ignore_error=EAGAIN when using this option.

HOWTO Outdated
@@ -2097,6 +2097,26 @@ with the caveat that when used on the command line, they must come after the
When hipri is set this determines the probability of a pvsync2 I/O being high
priority. The default is 100%.

.. option:: nowait : [pvsync2] [libaio] [io_uring]

By default if request cannot be executed immediately (e.g. resource starvation,
Copy link
Collaborator

Choose a reason for hiding this comment

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

default if request -> default if a request

HOWTO Outdated

By default if request cannot be executed immediately (e.g. resource starvation,
waiting on locks) it is queued and the initiating process will be blocked until
required the required resource becomes free.
Copy link
Collaborator

Choose a reason for hiding this comment

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

required the required -> the required

HOWTO Outdated
They return EOPNOTSUP instead of EAGAIN.

For cached I/O, using this option usually means a request operates only with
cached data. Currently RWF_NOWAIT flag does not supported for cached write.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Currently RWF_NOWAIT -> Currently the RWF_NOWAIT

.lname = "No Wait",
.type = FIO_OPT_BOOL,
.off1 = offsetof(struct ioring_options, nowait),
.help = "Use RWF_NOWAIT for read/writes",
Copy link
Collaborator

Choose a reason for hiding this comment

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

read -> reads

engines/libaio.c Outdated
.lname = "RWF_NOWAIT",
.type = FIO_OPT_BOOL,
.off1 = offsetof(struct libaio_options, nowait),
.help = "Set RWF_NOWAIT for read/write",
Copy link
Collaborator

Choose a reason for hiding this comment

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

read -> reads

@@ -185,6 +186,15 @@ static struct fio_option options[] = {
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_IOURING,
},
{
.name = "nowait",
.lname = "No Wait",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe use the same lname as below: RWF_NOWAIT (or the later ones the same as this)?

fio.1 Outdated
Set RWF_NOWAIT on I/O, indicating to the kernel to do not wait if request
cannot be executed immediately. (supported from the 4.14 Linux kernel)

It is useful to also use ignore_error=EAGAIN when using this option.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should just match the same text as the HOWTO (but with different formatting if necessary)

engines/libaio.c Show resolved Hide resolved
Add bool option "nowait" into engines which could support this feature.

Add test for libaio >= 0.3.111 into configure script to be compatible with
prior versions where field iocb.aio_rw_flags was declared as "__pad2".


By default if a request cannot be executed immediately (e.g. resource starvation,
waiting on locks) it is queued and the initiating process will be blocked until
the required resource becomes free.

This option sets the RWF_NOWAIT flag (supported from the 4.14 Linux kernel) and
the call will return instantly with EAGAIN or a partial result rather than waiting.

It is useful to also use ignore_error=EAGAIN when using this option.

Note: glibc 2.27, 2.28 have a bug in syscall wrappers preadv2, pwritev2.
They return EOPNOTSUP instead of EAGAIN.

For cached I/O, using this option usually means a request operates only with
cached data. Currently the RWF_NOWAIT flag does not supported for cached write.

For direct I/O, requests will only succeed if cache invalidation isn't required,
file blocks are fully allocated and the disk request could be issued immediately.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Link: https://lwn.net/Articles/724631/
Copy link
Collaborator

@sitsofe sitsofe left a comment

Choose a reason for hiding this comment

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

LGTM! @axboe what do you think?

@axboe axboe merged commit 24f67d1 into axboe:master Jun 10, 2020
@koct9i koct9i deleted the nowait branch August 23, 2024 15:02
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