qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: [Qemu-devel] RFC migration of zero pages
       [not found]                 ` <20130131211844.GC16941@redhat.com>
@ 2013-02-01  7:30                   ` Avi Kivity
  0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2013-02-01  7:30 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Orit Wasserman, Peter Lieven, qemu-devel@nongnu.org, Gleb Natapov

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

On Jan 31, 2013 11:14 PM, "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> On Thu, Jan 31, 2013 at 05:20:02PM +0200, Avi Kivity wrote:
> > On Thu, Jan 31, 2013 at 4:42 PM, Gleb Natapov <gleb@redhat.com> wrote:
> > > On Thu, Jan 31, 2013 at 04:36:25PM +0200, Avi Kivity wrote:
> > >> On Thu, Jan 31, 2013 at 4:30 PM, Gleb Natapov <gleb@redhat.com>
wrote:
> > >> >> >
> > >> >> > Avi/Michael do you remember why mincore can't be used to check
if a guest
> > >> >> page is unmapped?
> > >> >>
> > >> >> A page may be not in core, but also nonzero (for example swap).
> > >> > Yes, mincore() should not be used as zero page check, but it can
be used
> > >> > as an indicator that page can be dealt with in dead stage of
migration
> > >> > since it is likely zero and will not take much time to send.
> > >>
> > >> Or it's swapped, in which case we know nothing about it.
> > >>
> > >> > It is
> > > Of course, that is why I said "likely' :)
> > >
> > >> > possible to call madvise(MADV_WILLNEED) on them meanwhile to
pre-load
> > >> > swap without faulting on each page individually.
> > >>
> > >> During migration you're faulting like mad anyway.
> > > That's guest faulting on dirty bit logging, as far as I understand
Orit
> > > says that in addition to that she sees a lot of faults generated by
> > > migration reading unmapped guest memory. She wants to eliminate at
least
> > > those.
> >
> > For that, we once talked about extending mincore() to return info
> > whether a page is known zero (anonymous memory without a backing page,
> > or backing page == zero page).
>
> Shoudn't be hard to expose in /proc, no?

Unfortunately.

>
> > But I doubt it's worth it, yes we're
> > faulting a lot, but it's still a lot cheaper than actually sending a
> > page, so we're still ahead of a non-idle guest.
>
> It's not just fault, reading in the page is bad for the cache.
>

There's just one zero page.

[-- Attachment #2: Type: text/html, Size: 2717 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] RFC migration of zero pages
       [not found]   ` <20130131094809.GO15004@redhat.com>
       [not found]     ` <510A47F1.6070302@redhat.com>
@ 2013-02-01 16:58     ` Paolo Bonzini
  1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2013-02-01 16:58 UTC (permalink / raw)
  To: Gleb Natapov; +Cc: Orit Wasserman, Peter Lieven, qemu-devel@nongnu.org

Il 31/01/2013 10:48, Gleb Natapov ha scritto:
>> Also I notice that the bottle neck in migrating unmapped pages is the detection of those pages
>> because we map the pages in order to check them, for a large guest this is very expensive as mapping a page
>> results in a page fault in the host.
>> So what will be very helpful is actually locating those pages without mapping them
>> which looks very complicated.
>>
> What is wrong with mincore()?

As Avi said, it returns false if the memory is in swap.

Note that while we do take a page fault, the recent kernel patch to
introduce a huge zero page might have reduced the cost in terms of both
clear_page and cache misses.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] RFC migration of zero pages
       [not found]     ` <510A2C3D.3060001@redhat.com>
@ 2013-02-01 17:03       ` Paolo Bonzini
  2013-02-03  7:24         ` Peter Lieven
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2013-02-01 17:03 UTC (permalink / raw)
  To: Orit Wasserman; +Cc: Peter Lieven, qemu-devel@nongnu.org

Il 31/01/2013 09:33, Orit Wasserman ha scritto:
>> > If my above assumption that the guest reads unmapped memory as zeroes is right, this mapping
>> > is not necessary in the case of a zero dup page.
>> > 
>> > We just have to make sure that we are still in the very first round when deciding not to sent
>> > a zero page, because otherwise it could be a page that has become zero during migration and
>> > this of course has to be transferred.
> OK, so if we won't send the pages than it won't be allocate in the dst and it can improve both 
> memory usage and reduce cpu consumption on it.
> That can be good for over commit scenario.

We don't allocate zero pages in the destination:

#ifndef _WIN32
            if (ch == 0 &&
                (!kvm_enabled() || kvm_has_sync_mmu()) &&
                getpagesize() <= TARGET_PAGE_SIZE) {
                qemu_madvise(host, TARGET_PAGE_SIZE, QEMU_MADV_DONTNEED);
            }
#endif

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] RFC migration of zero pages
  2013-02-01 17:03       ` Paolo Bonzini
@ 2013-02-03  7:24         ` Peter Lieven
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Lieven @ 2013-02-03  7:24 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Orit Wasserman, qemu-devel@nongnu.org

Am 01.02.2013 18:03, schrieb Paolo Bonzini:
> Il 31/01/2013 09:33, Orit Wasserman ha scritto:
>>>> If my above assumption that the guest reads unmapped memory as zeroes is right, this mapping
>>>> is not necessary in the case of a zero dup page.
>>>>
>>>> We just have to make sure that we are still in the very first round when deciding not to sent
>>>> a zero page, because otherwise it could be a page that has become zero during migration and
>>>> this of course has to be transferred.
>> OK, so if we won't send the pages than it won't be allocate in the dst and it can improve both 
>> memory usage and reduce cpu consumption on it.
>> That can be good for over commit scenario.
> 
> We don't allocate zero pages in the destination:
> 
> #ifndef _WIN32
>             if (ch == 0 &&
>                 (!kvm_enabled() || kvm_has_sync_mmu()) &&
>                 getpagesize() <= TARGET_PAGE_SIZE) {
>                 qemu_madvise(host, TARGET_PAGE_SIZE, QEMU_MADV_DONTNEED);
>             }
> #endif

Sorry I was not aware of this. So the only possible benefit left would be to not sent zero pages in
the first round at all which would avoid the 9 bytes (header + ch) per page + memset and madvise on the target.

Peter


> 
> Paolo
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-03  7:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <510A15DC.3070706@dlhnet.de>
     [not found] ` <510A218C.2000903@redhat.com>
     [not found]   ` <20130131094809.GO15004@redhat.com>
     [not found]     ` <510A47F1.6070302@redhat.com>
     [not found]       ` <CAEbWaipEYFLshmMxm3R+n=Kk+ya7+m0-B5K__2RqeMM_vex4SA@mail.gmail.com>
     [not found]         ` <20130131143043.GD23213@redhat.com>
     [not found]           ` <CAEbWaiqJ1pjaXeBtqf7Ww-KX8x7t+bvn6JzhPr8KbtA6ADBH1g@mail.gmail.com>
     [not found]             ` <20130131144243.GE23213@redhat.com>
     [not found]               ` <CAEbWaio1SM3u=-_paMkU6sLK1SWih0_gUgMDQhJ-N37dTuX4=Q@mail.gmail.com>
     [not found]                 ` <20130131211844.GC16941@redhat.com>
2013-02-01  7:30                   ` [Qemu-devel] RFC migration of zero pages Avi Kivity
2013-02-01 16:58     ` Paolo Bonzini
     [not found]   ` <85C05B4E-E6BC-43D3-917F-E3EAC674F2EA@dlhnet.de>
     [not found]     ` <510A2C3D.3060001@redhat.com>
2013-02-01 17:03       ` Paolo Bonzini
2013-02-03  7:24         ` Peter Lieven

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).