[libvirt] [PATCH RFC] iohelper: Introduces a small sleep do avoid hunging other tasks
Leonardo Bras
leonardo at linux.ibm.com
Thu May 9 21:52:01 UTC 2019
On Thu, 2019-05-09 at 17:59 -0300, Leonardo Bras wrote:
> While dumping very large VMs (over 128GB), iohelper seems to cause
> very intense IO usage on the disk, and it causes some processes
> (like journald) to hung, and depending on kernel configuration,
> to panic.
>
> This change creates a time window, after every 10GB written, so
> this processes can write to the disk, and avoid hunging.
>
> Signed-off-by: Leonardo Bras <leonardo at linux.ibm.com>
> ---
> src/util/iohelper.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/src/util/iohelper.c b/src/util/iohelper.c
> index ddc338b7c7..164c1e2085 100644
> --- a/src/util/iohelper.c
> +++ b/src/util/iohelper.c
> @@ -52,6 +52,8 @@ runIO(const char *path, int fd, int oflags)
> unsigned long long total = 0;
> bool direct = O_DIRECT && ((oflags & O_DIRECT) != 0);
> off_t end = 0;
> + const unsigned long long sleep_step = (long long)10*1024*1024*1024;
> + unsigned long long next_sleep = sleep_step;
>
> #if HAVE_POSIX_MEMALIGN
> if (posix_memalign(&base, alignMask + 1, buflen)) {
> @@ -128,6 +130,12 @@ runIO(const char *path, int fd, int oflags)
>
> total += got;
>
> + /* sleeps for a while to avoid hunging other tasks */
> + if (total > next_sleep) {
> + next_sleep += sleep_step;
> + usleep(100*1000);
> + }
> +
> /* handle last write size align in direct case */
> if (got < buflen && direct && fdout == fd) {
> ssize_t aligned_got = (got + alignMask) & ~alignMask;
please note there is a typo on the subject:
current:
iohelper: Introduces a small sleep do avoid hunging other tasks
fixed:
iohelper: Introduces a small sleep to avoid hunging other tasks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190509/5e504eb0/attachment-0001.sig>
More information about the libvir-list
mailing list