qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>, Peter Lieven <pl@kamp.de>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] qemu-img convert cache mode for source
Date: Wed, 26 Feb 2014 08:54:40 -0700	[thread overview]
Message-ID: <530E0E40.3070907@redhat.com> (raw)
In-Reply-To: <20140226154154.GB20820@stefanha-thinkpad.muc.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1841 bytes --]

On 02/26/2014 08:41 AM, Stefan Hajnoczi wrote:
> On Wed, Feb 26, 2014 at 11:14:04AM +0100, Peter Lieven wrote:
>> I was wondering if it would be a good idea to set the O_DIRECT mode for the source
>> files of a qemu-img convert process if the source is a host_device?
>>
>> Currently the backup of a host device is polluting the page cache.
> 
> Points to consider:
> 
> 1. O_DIRECT does not work on Linux tmpfs, you get EINVAL when opening
>    the file.  A fallback is necessary.
> 
> 2. O_DIRECT has no readahead so performance could actually decrease.
>    The question is, how important is reahead versus polluting page
>    cache?
> 
> 3. For raw files it would make sense to tell the kernel that access is
>    sequential and data will be used only once.  Then we can get the best
>    of both worlds (avoid polluting page cache but still get readahead).
>    This is done using posix_fadvise(2).

Except that posix_fadvise is advisory only (the kernel is free to ignore
it), and currently not stateful enough inside the kernel to be useful
when handing fds between processes.  For several years now, I've asked
if the kernel could provide better guarantees about what posix_fadvise
can actually do, and expose user-space introspection of those guarantees
through procfs and/or fpathconf.

See https://bugzilla.redhat.com/show_bug.cgi?id=634653 for some
backstory on libvirt's dealings with O_DIRECT. I'd really like to ditch
libvirt's use of O_DIRECT in favor of posix_fadvise for avoiding page
cache pollution, but the kernel isn't at a point yet that lets libvirt
do that.  I suppose that if the kernel ever does improve posix_fadvise,
then both libvirt and qemu would benefit from it.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2014-02-26 15:56 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-26 10:14 [Qemu-devel] qemu-img convert cache mode for source Peter Lieven
2014-02-26 15:41 ` Stefan Hajnoczi
2014-02-26 15:54   ` Eric Blake [this message]
2014-02-26 16:01   ` Peter Lieven
2014-02-27  8:57     ` Stefan Hajnoczi
2014-02-28 14:35       ` Peter Lieven
2014-03-03 10:38         ` Kevin Wolf
2014-03-03 11:20           ` Peter Lieven
2014-03-03 12:59             ` Paolo Bonzini
2014-03-03 13:07               ` Peter Lieven
2014-03-03 12:03         ` Stefan Hajnoczi
2014-03-03 12:20           ` Peter Lieven
2014-03-04  9:24             ` Stefan Hajnoczi
2014-03-05 14:44               ` Peter Lieven
2014-03-05 15:20                 ` Marcus
2014-03-05 15:53                   ` Peter Lieven
2014-03-05 17:38                     ` Marcus
2014-03-05 18:09                       ` Peter Lieven
2014-03-06 10:41                         ` Stefan Hajnoczi
2014-03-06 18:58                           ` Peter Lieven
2014-03-06 10:29                 ` Stefan Hajnoczi
2014-03-06 11:29                   ` Paolo Bonzini
2014-03-06 14:19                     ` Liguori, Anthony
2014-03-06 18:07                       ` Peter Lieven
2014-03-07  8:03                       ` Peter Lieven
2014-02-27  1:10   ` Fam Zheng
2014-02-27 11:07     ` Kevin Wolf
2014-02-27 16:12       ` Peter Lieven
2014-03-03 10:40         ` Kevin Wolf

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=530E0E40.3070907@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --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).