qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing


From: Anthony Liguori
Subject: Re: [Qemu-devel] Re: [Qemu-commits] [COMMIT 3086844] Instead of writing a zero page, madvise it away
Date: Mon, 22 Jun 2009 11:58:17 -0500
User-agent: Thunderbird 2.0.0.21 (X11/20090320)

Avi Kivity wrote:
On 06/22/2009 07:25 PM, Anthony Liguori wrote:


Xen had a similar issue. This ends up biting people who overcommit their VMs via ballooning, live migration, and badness ensues. At least for us, the error is swapping but madvise also avoids the issue by never consuming that memory to begin with.

Right. I'd love to do madvise() on the source node as well if we fault in a page and find out it's zero, but the guest (and aio) is still running and we might drop live data. We need a madvise(MADV_DONTNEED_IFZERO), or a mincore() flag that tells us if the page exists (vs. swapped). ksm would also do this, but it is overkill for some applications.

Note that the patch contains a small bug -- the kernel is allowed to ignore the advise according to the manual page, so it's better to memset() the memory before dropping it.

Hrm, that's not quite how I interpreted the man page.

"This call
 does not influence the semantics of the application (except in the case
 of  MADV_DONTNEED),  but  may influence its performance.  The kernel is
 free to ignore the advice."

MADV_DONTNEED is called out as changing the application semantics. Specifically, I think the kernel has to zero-fill even if it choose to ignore the advice.

I limited the guard to Linux specifically because I was unsure about that behavior but it would be good to clarify if anyone knows how.

--
Regards,

Anthony Liguori





reply via email to

[Prev in Thread] Current Thread [Next in Thread]