From: Kevin Wolf <kwolf@redhat.com>
To: Alberto Garcia <berto@igalia.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-2.8 0/4] Allow 'cache-clean-interval' in Linux only
Date: Mon, 28 Nov 2016 15:46:14 +0100 [thread overview]
Message-ID: <20161128144614.GA4754@noname.redhat.com> (raw)
In-Reply-To: <cover.1480072972.git.berto@igalia.com>
Am 25.11.2016 um 12:27 hat Alberto Garcia geschrieben:
> Hi all,
>
> The cache-clean-interval setting of qcow2 frees the memory of the L2
> cache tables that haven't been used after a certain interval of time.
>
> QEMU uses madvise() with MADV_DONTNEED for this. After that call, the
> data in the specified cache tables is discarded by the kernel. The
> problem with this behavior is that it is Linux-specific. madvise()
> itself is not a standard system call and while other implementations
> (e.g. FreeBSD) also have MADV_DONTNEED, they don't share the same
> semantics.
>
> POSIX defines posix_madvise(), which has POSIX_MADV_DONTNEED, and
> that's what QEMU uses in systems that don't implement madvise().
> However POSIX_MADV_DONTNEED also has different semantics and cannot be
> used for our purposes. As a matter of fact, in glibc it is a no-op:
>
> https://github.molgen.mpg.de/git-mirror/glibc/blob/glibc-2.23/sysdeps/unix/sysv/linux/posix_madvise.c
>
> So while this all is mentioned in the QEMU documentation, there's
> nothing preventing users of other systems from trying to use this
> feature. In non-Linux systems it is worse than a no-op: it invalidates
> perfectly valid cache tables for no reason without freeing their
> memory.
>
> This series makes Linux a hard requirement for cache-clean-interval
> and prints an error message in other systems.
Thanks, applied to the block branch.
Kevin
prev parent reply other threads:[~2016-11-28 14:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-25 11:27 [Qemu-devel] [PATCH for-2.8 0/4] Allow 'cache-clean-interval' in Linux only Alberto Garcia
2016-11-25 11:27 ` [Qemu-devel] [PATCH 1/4] qcow2: Make qcow2_cache_table_release() work only in Linux Alberto Garcia
2016-11-25 11:27 ` [Qemu-devel] [PATCH 2/4] qcow2: Allow 'cache-clean-interval' in Linux only Alberto Garcia
2016-11-25 11:27 ` [Qemu-devel] [PATCH 3/4] qcow2: Remove stale comment Alberto Garcia
2016-11-25 11:27 ` [Qemu-devel] [PATCH 4/4] docs: Specify that cache-clean-interval is only supported in Linux Alberto Garcia
2016-11-28 14:46 ` 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=20161128144614.GA4754@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=berto@igalia.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.