From: Kevin Wolf <kwolf@redhat.com>
To: Prasad Pandit <ppandit@redhat.com>
Cc: stefanha@redhat.com, qemu-block@nongnu.org,
qemu-devel@nongnu.org, mtosatti@redhat.com,
Prasad Pandit <pjp@fedoraproject.org>
Subject: Re: [PATCH v4] linux-aio: add IO_CMD_FDSYNC command support
Date: Wed, 24 Apr 2024 14:17:38 +0200 [thread overview]
Message-ID: <Zij4YnZxXwXFcnN3@redhat.com> (raw)
In-Reply-To: <20240314111628.1508636-1-ppandit@redhat.com>
Am 14.03.2024 um 12:16 hat Prasad Pandit geschrieben:
> From: Prasad Pandit <pjp@fedoraproject.org>
>
> Libaio defines IO_CMD_FDSYNC command to sync all outstanding
> asynchronous I/O operations, by flushing out file data to the
> disk storage.
>
> Enable linux-aio to submit such aio request. This helps to
> reduce latency induced via pthread_create calls by
> thread-pool (aio=threads).
>
> Signed-off-by: Prasad Pandit <pjp@fedoraproject.org>
As we discussed in chat, it would be good to be more detailed about the
scenario that we're really concerned about here. The commit message
above sounds like submitting fdsync takes too long, but the real concern
seems to be about the effect that creating and destroying a thread has
on a vcpu by adding a TLB flush. Describing the mechanisms, the sequence
of operations that happen and the problem this causes in more detail
would make the commit message a lot more useful.
> block/file-posix.c | 7 +++++++
> block/linux-aio.c | 21 ++++++++++++++++++++-
> include/block/raw-aio.h | 1 +
> 3 files changed, 28 insertions(+), 1 deletion(-)
>
> v4: New boolean field to indicate if aio_fdsync is available or not.
> It is set at file open time and checked before AIO_FLUSH call.
> - https://lists.nongnu.org/archive/html/qemu-devel/2024-03/msg03701.html
>
> diff --git a/block/file-posix.c b/block/file-posix.c
> index 35684f7e21..78a8cea03b 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -159,6 +159,7 @@ typedef struct BDRVRawState {
> bool has_discard:1;
> bool has_write_zeroes:1;
> bool use_linux_aio:1;
> + bool has_laio_fdsync:1;
> bool use_linux_io_uring:1;
> int page_cache_inconsistent; /* errno from fdatasync failure */
> bool has_fallocate;
> @@ -718,6 +719,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
> ret = -EINVAL;
> goto fail;
> }
> + s->has_laio_fdsync = laio_has_fdsync(s->fd);
I think this should be conditional on s->use_linux_aio. No point in
probing it if we'll never call it anyway.
Kevin
prev parent reply other threads:[~2024-04-24 12:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-14 11:16 [PATCH v4] linux-aio: add IO_CMD_FDSYNC command support Prasad Pandit
2024-03-14 12:56 ` Stefan Hajnoczi
2024-04-24 12:17 ` Kevin Wolf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zij4YnZxXwXFcnN3@redhat.com \
--to=kwolf@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pjp@fedoraproject.org \
--cc=ppandit@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).