Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1350126 > unrolled thread
| Started by | Roman Kagan <rkagan@virtuozzo.com> |
|---|---|
| First post | 2016-03-04 11:30 +0100 |
| Last post | 2016-03-09 07:20 +0100 |
| Articles | 20 on this page of 25 — 6 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization Roman Kagan <rkagan@virtuozzo.com> - 2016-03-04 11:30 +0100
RE: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Li, Liang Z" <liang.z.li@intel.com> - 2016-03-04 15:30 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Michael S. Tsirkin" <mst@redhat.com> - 2016-03-04 15:50 +0100
RE: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Li, Liang Z" <liang.z.li@intel.com> - 2016-03-04 16:50 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Michael S. Tsirkin" <mst@redhat.com> - 2016-03-05 21:00 +0100
RE: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Li, Liang Z" <liang.z.li@intel.com> - 2016-03-07 08:00 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Michael S. Tsirkin" <mst@redhat.com> - 2016-03-07 12:50 +0100
RE: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Li, Liang Z" <liang.z.li@intel.com> - 2016-03-07 16:10 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization Roman Kagan <rkagan@virtuozzo.com> - 2016-03-09 15:30 +0100
RE: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Li, Liang Z" <liang.z.li@intel.com> - 2016-03-09 16:30 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Michael S. Tsirkin" <mst@redhat.com> - 2016-03-09 16:40 +0100
RE: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Li, Liang Z" <liang.z.li@intel.com> - 2016-03-10 02:50 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Michael S. Tsirkin" <mst@redhat.com> - 2016-03-10 13:30 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Michael S. Tsirkin" <mst@redhat.com> - 2016-03-09 16:50 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization Roman Kagan <rkagan@virtuozzo.com> - 2016-03-09 18:10 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Michael S. Tsirkin" <mst@redhat.com> - 2016-03-09 18:40 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization Roman Kagan <rkagan@virtuozzo.com> - 2016-03-10 11:30 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization Rik van Riel <riel@redhat.com> - 2016-03-09 20:40 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization Roman Kagan <rkagan@virtuozzo.com> - 2016-03-10 10:40 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization Paolo Bonzini <pbonzini@redhat.com> - 2016-03-04 17:30 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Dr. David Alan Gilbert" <dgilbert@redhat.com> - 2016-03-04 20:00 +0100
RE: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Li, Liang Z" <liang.z.li@intel.com> - 2016-03-07 06:40 +0100
Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization Roman Kagan <rkagan@virtuozzo.com> - 2016-03-09 14:30 +0100
RE: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Li, Liang Z" <liang.z.li@intel.com> - 2016-03-09 15:20 +0100
RE: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization "Li, Liang Z" <liang.z.li@intel.com> - 2016-03-09 07:20 +0100
Page 1 of 2 [1] 2 Next page →
| From | Roman Kagan <rkagan@virtuozzo.com> |
|---|---|
| Date | 2016-03-04 11:30 +0100 |
| Subject | Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization |
| Message-ID | <r8V9E-5bS-11@gated-at.bofh.it> |
On Fri, Mar 04, 2016 at 09:08:44AM +0000, Li, Liang Z wrote: > > On Fri, Mar 04, 2016 at 01:52:53AM +0000, Li, Liang Z wrote: > > > > I wonder if it would be possible to avoid the kernel changes by > > > > parsing /proc/self/pagemap - if that can be used to detect > > > > unmapped/zero mapped pages in the guest ram, would it achieve the > > same result? > > > > > > Only detect the unmapped/zero mapped pages is not enough. Consider > > the > > > situation like case 2, it can't achieve the same result. > > > > Your case 2 doesn't exist in the real world. If people could stop their main > > memory consumer in the guest prior to migration they wouldn't need live > > migration at all. > > The case 2 is just a simplified scenario, not a real case. > As long as the guest's memory usage does not keep increasing, or not always run out, > it can be covered by the case 2. The memory usage will keep increasing due to ever growing caches, etc, so you'll be left with very little free memory fairly soon. > > I tend to think you can safely assume there's no free memory in the guest, so > > there's little point optimizing for it. > > If this is true, we should not inflate the balloon either. We certainly should if there's "available" memory, i.e. not free but cheap to reclaim. > > OTOH it makes perfect sense optimizing for the unmapped memory that's > > made up, in particular, by the ballon, and consider inflating the balloon right > > before migration unless you already maintain it at the optimal size for other > > reasons (like e.g. a global resource manager optimizing the VM density). > > > > Yes, I believe the current balloon works and it's simple. Do you take the performance impact for consideration? > For and 8G guest, it takes about 5s to inflating the balloon. But it only takes 20ms to traverse the free_list and > construct the free pages bitmap. I don't have any feeling of how important the difference is. And if the limiting factor for balloon inflation speed is the granularity of communication it may be worth optimizing that, because quick balloon reaction may be important in certain resource management scenarios. > By inflating the balloon, all the guest's pages are still be processed (zero page checking). Not sure what you mean. If you describe the current state of affairs that's exactly the suggested optimization point: skip unmapped pages. > The only advantage of ' inflating the balloon before live migration' is simple, nothing more. That's a big advantage. Another one is that it does something useful in real-world scenarios. Roman.
[toc] | [next] | [standalone]
| From | "Li, Liang Z" <liang.z.li@intel.com> |
|---|---|
| Date | 2016-03-04 15:30 +0100 |
| Message-ID | <r8YTT-810-3@gated-at.bofh.it> |
| In reply to | #1350126 |
> Subject: Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration > optimization > > On Fri, Mar 04, 2016 at 09:08:44AM +0000, Li, Liang Z wrote: > > > On Fri, Mar 04, 2016 at 01:52:53AM +0000, Li, Liang Z wrote: > > > > > I wonder if it would be possible to avoid the kernel changes > > > > > by parsing /proc/self/pagemap - if that can be used to detect > > > > > unmapped/zero mapped pages in the guest ram, would it achieve > > > > > the > > > same result? > > > > > > > > Only detect the unmapped/zero mapped pages is not enough. > Consider > > > the > > > > situation like case 2, it can't achieve the same result. > > > > > > Your case 2 doesn't exist in the real world. If people could stop > > > their main memory consumer in the guest prior to migration they > > > wouldn't need live migration at all. > > > > The case 2 is just a simplified scenario, not a real case. > > As long as the guest's memory usage does not keep increasing, or not > > always run out, it can be covered by the case 2. > > The memory usage will keep increasing due to ever growing caches, etc, so > you'll be left with very little free memory fairly soon. > I don't think so. > > > I tend to think you can safely assume there's no free memory in the > > > guest, so there's little point optimizing for it. > > > > If this is true, we should not inflate the balloon either. > > We certainly should if there's "available" memory, i.e. not free but cheap to > reclaim. > What's your mean by "available" memory? if they are not free, I don't think it's cheap. > > > OTOH it makes perfect sense optimizing for the unmapped memory > > > that's made up, in particular, by the ballon, and consider inflating > > > the balloon right before migration unless you already maintain it at > > > the optimal size for other reasons (like e.g. a global resource manager > optimizing the VM density). > > > > > > > Yes, I believe the current balloon works and it's simple. Do you take the > performance impact for consideration? > > For and 8G guest, it takes about 5s to inflating the balloon. But it > > only takes 20ms to traverse the free_list and construct the free pages > bitmap. > > I don't have any feeling of how important the difference is. And if the > limiting factor for balloon inflation speed is the granularity of communication > it may be worth optimizing that, because quick balloon reaction may be > important in certain resource management scenarios. > > > By inflating the balloon, all the guest's pages are still be processed (zero > page checking). > > Not sure what you mean. If you describe the current state of affairs that's > exactly the suggested optimization point: skip unmapped pages. > You'd better check the live migration code. > > The only advantage of ' inflating the balloon before live migration' is simple, > nothing more. > > That's a big advantage. Another one is that it does something useful in real- > world scenarios. > I don't think the heave performance impaction is something useful in real world scenarios. Liang > Roman.
[toc] | [prev] | [next] | [standalone]
| From | "Michael S. Tsirkin" <mst@redhat.com> |
|---|---|
| Date | 2016-03-04 15:50 +0100 |
| Message-ID | <r8Zdf-89n-3@gated-at.bofh.it> |
| In reply to | #1350256 |
On Fri, Mar 04, 2016 at 02:26:49PM +0000, Li, Liang Z wrote:
> > Subject: Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration
> > optimization
> >
> > On Fri, Mar 04, 2016 at 09:08:44AM +0000, Li, Liang Z wrote:
> > > > On Fri, Mar 04, 2016 at 01:52:53AM +0000, Li, Liang Z wrote:
> > > > > > I wonder if it would be possible to avoid the kernel changes
> > > > > > by parsing /proc/self/pagemap - if that can be used to detect
> > > > > > unmapped/zero mapped pages in the guest ram, would it achieve
> > > > > > the
> > > > same result?
> > > > >
> > > > > Only detect the unmapped/zero mapped pages is not enough.
> > Consider
> > > > the
> > > > > situation like case 2, it can't achieve the same result.
> > > >
> > > > Your case 2 doesn't exist in the real world. If people could stop
> > > > their main memory consumer in the guest prior to migration they
> > > > wouldn't need live migration at all.
> > >
> > > The case 2 is just a simplified scenario, not a real case.
> > > As long as the guest's memory usage does not keep increasing, or not
> > > always run out, it can be covered by the case 2.
> >
> > The memory usage will keep increasing due to ever growing caches, etc, so
> > you'll be left with very little free memory fairly soon.
> >
>
> I don't think so.
Here's my laptop:
KiB Mem : 16048560 total, 8574956 free, 3360532 used, 4113072 buff/cache
But here's a server:
KiB Mem: 32892768 total, 20092812 used, 12799956 free, 368704 buffers
What is the difference? A ton of tiny daemons not doing anything,
staying resident in memory.
> > > > I tend to think you can safely assume there's no free memory in the
> > > > guest, so there's little point optimizing for it.
> > >
> > > If this is true, we should not inflate the balloon either.
> >
> > We certainly should if there's "available" memory, i.e. not free but cheap to
> > reclaim.
> >
>
> What's your mean by "available" memory? if they are not free, I don't think it's cheap.
clean pages are cheap to drop as they don't have to be written.
whether they will be ever be used is another matter.
> > > > OTOH it makes perfect sense optimizing for the unmapped memory
> > > > that's made up, in particular, by the ballon, and consider inflating
> > > > the balloon right before migration unless you already maintain it at
> > > > the optimal size for other reasons (like e.g. a global resource manager
> > optimizing the VM density).
> > > >
> > >
> > > Yes, I believe the current balloon works and it's simple. Do you take the
> > performance impact for consideration?
> > > For and 8G guest, it takes about 5s to inflating the balloon. But it
> > > only takes 20ms to traverse the free_list and construct the free pages
> > bitmap.
> >
> > I don't have any feeling of how important the difference is. And if the
> > limiting factor for balloon inflation speed is the granularity of communication
> > it may be worth optimizing that, because quick balloon reaction may be
> > important in certain resource management scenarios.
> >
> > > By inflating the balloon, all the guest's pages are still be processed (zero
> > page checking).
> >
> > Not sure what you mean. If you describe the current state of affairs that's
> > exactly the suggested optimization point: skip unmapped pages.
> >
>
> You'd better check the live migration code.
What's there to check in migration code?
Here's the extent of what balloon does on output:
while (iov_to_buf(elem->out_sg, elem->out_num, offset, &pfn, 4) == 4) {
ram_addr_t pa;
ram_addr_t addr;
int p = virtio_ldl_p(vdev, &pfn);
pa = (ram_addr_t) p << VIRTIO_BALLOON_PFN_SHIFT;
offset += 4;
/* FIXME: remove get_system_memory(), but how? */
section = memory_region_find(get_system_memory(), pa, 1);
if (!int128_nz(section.size) || !memory_region_is_ram(section.mr))
continue;
trace_virtio_balloon_handle_output(memory_region_name(section.mr),
pa);
/* Using memory_region_get_ram_ptr is bending the rules a bit, but
should be OK because we only want a single page. */
addr = section.offset_within_region;
balloon_page(memory_region_get_ram_ptr(section.mr) + addr,
!!(vq == s->dvq));
memory_region_unref(section.mr);
}
so all that happens when we get a page is balloon_page.
and
static void balloon_page(void *addr, int deflate)
{
#if defined(__linux__)
if (!qemu_balloon_is_inhibited() && (!kvm_enabled() ||
kvm_has_sync_mmu())) {
qemu_madvise(addr, TARGET_PAGE_SIZE,
deflate ? QEMU_MADV_WILLNEED : QEMU_MADV_DONTNEED);
}
#endif
}
Do you see anything that tracks pages to help migration skip
the ballooned memory? I don't.
> > > The only advantage of ' inflating the balloon before live migration' is simple,
> > nothing more.
> >
> > That's a big advantage. Another one is that it does something useful in real-
> > world scenarios.
> >
>
> I don't think the heave performance impaction is something useful in real world scenarios.
>
> Liang
> > Roman.
So fix the performance then. You will have to try harder if you want to
convince people that the performance is due to bad host/guest interface,
and so we have to change *that*.
--
MST
[toc] | [prev] | [next] | [standalone]
| From | "Li, Liang Z" <liang.z.li@intel.com> |
|---|---|
| Date | 2016-03-04 16:50 +0100 |
| Message-ID | <r909j-mc-9@gated-at.bofh.it> |
| In reply to | #1350259 |
> > > > > > Only detect the unmapped/zero mapped pages is not enough.
> > > Consider
> > > > > the
> > > > > > situation like case 2, it can't achieve the same result.
> > > > >
> > > > > Your case 2 doesn't exist in the real world. If people could
> > > > > stop their main memory consumer in the guest prior to migration
> > > > > they wouldn't need live migration at all.
> > > >
> > > > The case 2 is just a simplified scenario, not a real case.
> > > > As long as the guest's memory usage does not keep increasing, or
> > > > not always run out, it can be covered by the case 2.
> > >
> > > The memory usage will keep increasing due to ever growing caches,
> > > etc, so you'll be left with very little free memory fairly soon.
> > >
> >
> > I don't think so.
>
> Here's my laptop:
> KiB Mem : 16048560 total, 8574956 free, 3360532 used, 4113072 buff/cache
>
> But here's a server:
> KiB Mem: 32892768 total, 20092812 used, 12799956 free, 368704 buffers
>
> What is the difference? A ton of tiny daemons not doing anything, staying
> resident in memory.
>
> > > > > I tend to think you can safely assume there's no free memory in
> > > > > the guest, so there's little point optimizing for it.
> > > >
> > > > If this is true, we should not inflate the balloon either.
> > >
> > > We certainly should if there's "available" memory, i.e. not free but
> > > cheap to reclaim.
> > >
> >
> > What's your mean by "available" memory? if they are not free, I don't think
> it's cheap.
>
> clean pages are cheap to drop as they don't have to be written.
> whether they will be ever be used is another matter.
>
> > > > > OTOH it makes perfect sense optimizing for the unmapped memory
> > > > > that's made up, in particular, by the ballon, and consider
> > > > > inflating the balloon right before migration unless you already
> > > > > maintain it at the optimal size for other reasons (like e.g. a
> > > > > global resource manager
> > > optimizing the VM density).
> > > > >
> > > >
> > > > Yes, I believe the current balloon works and it's simple. Do you
> > > > take the
> > > performance impact for consideration?
> > > > For and 8G guest, it takes about 5s to inflating the balloon. But
> > > > it only takes 20ms to traverse the free_list and construct the
> > > > free pages
> > > bitmap.
> > >
> > > I don't have any feeling of how important the difference is. And if
> > > the limiting factor for balloon inflation speed is the granularity
> > > of communication it may be worth optimizing that, because quick
> > > balloon reaction may be important in certain resource management
> scenarios.
> > >
> > > > By inflating the balloon, all the guest's pages are still be
> > > > processed (zero
> > > page checking).
> > >
> > > Not sure what you mean. If you describe the current state of
> > > affairs that's exactly the suggested optimization point: skip unmapped
> pages.
> > >
> >
> > You'd better check the live migration code.
>
> What's there to check in migration code?
> Here's the extent of what balloon does on output:
>
>
> while (iov_to_buf(elem->out_sg, elem->out_num, offset, &pfn, 4) == 4)
> {
> ram_addr_t pa;
> ram_addr_t addr;
> int p = virtio_ldl_p(vdev, &pfn);
>
> pa = (ram_addr_t) p << VIRTIO_BALLOON_PFN_SHIFT;
> offset += 4;
>
> /* FIXME: remove get_system_memory(), but how? */
> section = memory_region_find(get_system_memory(), pa, 1);
> if (!int128_nz(section.size) || !memory_region_is_ram(section.mr))
> continue;
>
>
> trace_virtio_balloon_handle_output(memory_region_name(section.mr),
> pa);
> /* Using memory_region_get_ram_ptr is bending the rules a bit, but
> should be OK because we only want a single page. */
> addr = section.offset_within_region;
> balloon_page(memory_region_get_ram_ptr(section.mr) + addr,
> !!(vq == s->dvq));
> memory_region_unref(section.mr);
> }
>
> so all that happens when we get a page is balloon_page.
> and
>
> static void balloon_page(void *addr, int deflate) { #if defined(__linux__)
> if (!qemu_balloon_is_inhibited() && (!kvm_enabled() ||
> kvm_has_sync_mmu())) {
> qemu_madvise(addr, TARGET_PAGE_SIZE,
> deflate ? QEMU_MADV_WILLNEED : QEMU_MADV_DONTNEED);
> }
> #endif
> }
>
>
> Do you see anything that tracks pages to help migration skip the ballooned
> memory? I don't.
>
No. And it's exactly what I mean. The ballooned memory is still processed during
live migration without skipping. The live migration code is in migration/ram.c.
>
> > > > The only advantage of ' inflating the balloon before live
> > > > migration' is simple,
> > > nothing more.
> > >
> > > That's a big advantage. Another one is that it does something
> > > useful in real- world scenarios.
> > >
> >
> > I don't think the heave performance impaction is something useful in real
> world scenarios.
> >
> > Liang
> > > Roman.
>
> So fix the performance then. You will have to try harder if you want to
> convince people that the performance is due to bad host/guest interface,
> and so we have to change *that*.
>
Actually, the PV solution is irrelevant with the balloon mechanism, I just use it
to transfer information between host and guest.
I am not sure if I should implement a new virtio device, and I want to get the answer from
the community.
In this RFC patch, to make things simple, I choose to extend the virtio-balloon and use the
extended interface to transfer the request and free_page_bimap content.
I am not intend to change the current virtio-balloon implementation.
Liang
> --
> MST
[toc] | [prev] | [next] | [standalone]
| From | "Michael S. Tsirkin" <mst@redhat.com> |
|---|---|
| Date | 2016-03-05 21:00 +0100 |
| Message-ID | <r9qwO-2v2-7@gated-at.bofh.it> |
| In reply to | #1350324 |
On Fri, Mar 04, 2016 at 03:49:37PM +0000, Li, Liang Z wrote:
> > > > > > > Only detect the unmapped/zero mapped pages is not enough.
> > > > Consider
> > > > > > the
> > > > > > > situation like case 2, it can't achieve the same result.
> > > > > >
> > > > > > Your case 2 doesn't exist in the real world. If people could
> > > > > > stop their main memory consumer in the guest prior to migration
> > > > > > they wouldn't need live migration at all.
> > > > >
> > > > > The case 2 is just a simplified scenario, not a real case.
> > > > > As long as the guest's memory usage does not keep increasing, or
> > > > > not always run out, it can be covered by the case 2.
> > > >
> > > > The memory usage will keep increasing due to ever growing caches,
> > > > etc, so you'll be left with very little free memory fairly soon.
> > > >
> > >
> > > I don't think so.
> >
> > Here's my laptop:
> > KiB Mem : 16048560 total, 8574956 free, 3360532 used, 4113072 buff/cache
> >
> > But here's a server:
> > KiB Mem: 32892768 total, 20092812 used, 12799956 free, 368704 buffers
> >
> > What is the difference? A ton of tiny daemons not doing anything, staying
> > resident in memory.
> >
> > > > > > I tend to think you can safely assume there's no free memory in
> > > > > > the guest, so there's little point optimizing for it.
> > > > >
> > > > > If this is true, we should not inflate the balloon either.
> > > >
> > > > We certainly should if there's "available" memory, i.e. not free but
> > > > cheap to reclaim.
> > > >
> > >
> > > What's your mean by "available" memory? if they are not free, I don't think
> > it's cheap.
> >
> > clean pages are cheap to drop as they don't have to be written.
> > whether they will be ever be used is another matter.
> >
> > > > > > OTOH it makes perfect sense optimizing for the unmapped memory
> > > > > > that's made up, in particular, by the ballon, and consider
> > > > > > inflating the balloon right before migration unless you already
> > > > > > maintain it at the optimal size for other reasons (like e.g. a
> > > > > > global resource manager
> > > > optimizing the VM density).
> > > > > >
> > > > >
> > > > > Yes, I believe the current balloon works and it's simple. Do you
> > > > > take the
> > > > performance impact for consideration?
> > > > > For and 8G guest, it takes about 5s to inflating the balloon. But
> > > > > it only takes 20ms to traverse the free_list and construct the
> > > > > free pages
> > > > bitmap.
> > > >
> > > > I don't have any feeling of how important the difference is. And if
> > > > the limiting factor for balloon inflation speed is the granularity
> > > > of communication it may be worth optimizing that, because quick
> > > > balloon reaction may be important in certain resource management
> > scenarios.
> > > >
> > > > > By inflating the balloon, all the guest's pages are still be
> > > > > processed (zero
> > > > page checking).
> > > >
> > > > Not sure what you mean. If you describe the current state of
> > > > affairs that's exactly the suggested optimization point: skip unmapped
> > pages.
> > > >
> > >
> > > You'd better check the live migration code.
> >
> > What's there to check in migration code?
> > Here's the extent of what balloon does on output:
> >
> >
> > while (iov_to_buf(elem->out_sg, elem->out_num, offset, &pfn, 4) == 4)
> > {
> > ram_addr_t pa;
> > ram_addr_t addr;
> > int p = virtio_ldl_p(vdev, &pfn);
> >
> > pa = (ram_addr_t) p << VIRTIO_BALLOON_PFN_SHIFT;
> > offset += 4;
> >
> > /* FIXME: remove get_system_memory(), but how? */
> > section = memory_region_find(get_system_memory(), pa, 1);
> > if (!int128_nz(section.size) || !memory_region_is_ram(section.mr))
> > continue;
> >
> >
> > trace_virtio_balloon_handle_output(memory_region_name(section.mr),
> > pa);
> > /* Using memory_region_get_ram_ptr is bending the rules a bit, but
> > should be OK because we only want a single page. */
> > addr = section.offset_within_region;
> > balloon_page(memory_region_get_ram_ptr(section.mr) + addr,
> > !!(vq == s->dvq));
> > memory_region_unref(section.mr);
> > }
> >
> > so all that happens when we get a page is balloon_page.
> > and
> >
> > static void balloon_page(void *addr, int deflate) { #if defined(__linux__)
> > if (!qemu_balloon_is_inhibited() && (!kvm_enabled() ||
> > kvm_has_sync_mmu())) {
> > qemu_madvise(addr, TARGET_PAGE_SIZE,
> > deflate ? QEMU_MADV_WILLNEED : QEMU_MADV_DONTNEED);
> > }
> > #endif
> > }
> >
> >
> > Do you see anything that tracks pages to help migration skip the ballooned
> > memory? I don't.
> >
>
> No. And it's exactly what I mean. The ballooned memory is still processed during
> live migration without skipping. The live migration code is in migration/ram.c.
So if guest acknowledged VIRTIO_BALLOON_F_MUST_TELL_HOST,
we can teach qemu to skip these pages.
Want to write a patch to do this?
> >
> > > > > The only advantage of ' inflating the balloon before live
> > > > > migration' is simple,
> > > > nothing more.
> > > >
> > > > That's a big advantage. Another one is that it does something
> > > > useful in real- world scenarios.
> > > >
> > >
> > > I don't think the heave performance impaction is something useful in real
> > world scenarios.
> > >
> > > Liang
> > > > Roman.
> >
> > So fix the performance then. You will have to try harder if you want to
> > convince people that the performance is due to bad host/guest interface,
> > and so we have to change *that*.
> >
>
> Actually, the PV solution is irrelevant with the balloon mechanism, I just use it
> to transfer information between host and guest.
> I am not sure if I should implement a new virtio device, and I want to get the answer from
> the community.
> In this RFC patch, to make things simple, I choose to extend the virtio-balloon and use the
> extended interface to transfer the request and free_page_bimap content.
>
> I am not intend to change the current virtio-balloon implementation.
>
> Liang
And the answer would depend on the answer to my question above.
Does balloon need an interface passing page bitmaps around?
Does this speed up any operations?
OTOH what if you use the regular balloon interface with your patches?
> > --
> > MST
[toc] | [prev] | [next] | [standalone]
| From | "Li, Liang Z" <liang.z.li@intel.com> |
|---|---|
| Date | 2016-03-07 08:00 +0100 |
| Message-ID | <r9Xj4-7Of-5@gated-at.bofh.it> |
| In reply to | #1350964 |
> > No. And it's exactly what I mean. The ballooned memory is still > > processed during live migration without skipping. The live migration code is > in migration/ram.c. > > So if guest acknowledged VIRTIO_BALLOON_F_MUST_TELL_HOST, we can > teach qemu to skip these pages. > Want to write a patch to do this? > Yes, we really can teach qemu to skip these pages and it's not hard. The problem is the poor performance, this PV solution is aimed to make it more efficient and reduce the performance impact on guest. > > > > > > > > > The only advantage of ' inflating the balloon before live > > > > > > migration' is simple, > > > > > nothing more. > > > > > > > > > > That's a big advantage. Another one is that it does something > > > > > useful in real- world scenarios. > > > > > > > > > > > > > I don't think the heave performance impaction is something useful > > > > in real > > > world scenarios. > > > > > > > > Liang > > > > > Roman. > > > > > > So fix the performance then. You will have to try harder if you want > > > to convince people that the performance is due to bad host/guest > > > interface, and so we have to change *that*. > > > > > > > Actually, the PV solution is irrelevant with the balloon mechanism, I > > just use it to transfer information between host and guest. > > I am not sure if I should implement a new virtio device, and I want to > > get the answer from the community. > > In this RFC patch, to make things simple, I choose to extend the > > virtio-balloon and use the extended interface to transfer the request and > free_page_bimap content. > > > > I am not intend to change the current virtio-balloon implementation. > > > > Liang > > And the answer would depend on the answer to my question above. > Does balloon need an interface passing page bitmaps around? Yes, I need a new interface. > Does this speed up any operations? No, a new interface will not speed up anything, but it is the easiest way to solve the compatibility issue. > OTOH what if you use the regular balloon interface with your patches? > The regular balloon interfaces have their specific function and I can't use them in my patches. If using these regular interface, I have to do a lot of changes to keep the compatibility. > > > > -- > > > MST
[toc] | [prev] | [next] | [standalone]
| From | "Michael S. Tsirkin" <mst@redhat.com> |
|---|---|
| Date | 2016-03-07 12:50 +0100 |
| Message-ID | <ra1PH-2jh-5@gated-at.bofh.it> |
| In reply to | #1351330 |
On Mon, Mar 07, 2016 at 06:49:19AM +0000, Li, Liang Z wrote: > > > No. And it's exactly what I mean. The ballooned memory is still > > > processed during live migration without skipping. The live migration code is > > in migration/ram.c. > > > > So if guest acknowledged VIRTIO_BALLOON_F_MUST_TELL_HOST, we can > > teach qemu to skip these pages. > > Want to write a patch to do this? > > > > Yes, we really can teach qemu to skip these pages and it's not hard. > The problem is the poor performance, this PV solution Balloon is always PV. And do not call patches solutions please. > is aimed to make it more > efficient and reduce the performance impact on guest. We need to get a bit beyond this. You are making multiple changes, it seems to make sense to split it all up, and analyse each change separately. If you don't this patchset will be stuck: as you have seen people aren't convinced it actually helps with real workloads. > > > > > > > > > > > The only advantage of ' inflating the balloon before live > > > > > > > migration' is simple, > > > > > > nothing more. > > > > > > > > > > > > That's a big advantage. Another one is that it does something > > > > > > useful in real- world scenarios. > > > > > > > > > > > > > > > > I don't think the heave performance impaction is something useful > > > > > in real > > > > world scenarios. > > > > > > > > > > Liang > > > > > > Roman. > > > > > > > > So fix the performance then. You will have to try harder if you want > > > > to convince people that the performance is due to bad host/guest > > > > interface, and so we have to change *that*. > > > > > > > > > > Actually, the PV solution is irrelevant with the balloon mechanism, I > > > just use it to transfer information between host and guest. > > > I am not sure if I should implement a new virtio device, and I want to > > > get the answer from the community. > > > In this RFC patch, to make things simple, I choose to extend the > > > virtio-balloon and use the extended interface to transfer the request and > > free_page_bimap content. > > > > > > I am not intend to change the current virtio-balloon implementation. > > > > > > Liang > > > > And the answer would depend on the answer to my question above. > > Does balloon need an interface passing page bitmaps around? > > Yes, I need a new interface. Possibly, but you will need to justify this at some level if you care about upstreaming your patches. > > Does this speed up any operations? > > No, a new interface will not speed up anything, but it is the easiest way to solve the compatibility issue. A bunch of new code is often easier to write than to figure out the old one, but if we keep piling it up we'll end up with an unmaintainable mess. So we are rather careful about adding new interfaces, and we try to make them generic sometimes even at cost of slight inefficiencies. > > OTOH what if you use the regular balloon interface with your patches? > > > > The regular balloon interfaces have their specific function and I can't use them in my patches. > If using these regular interface, I have to do a lot of changes to keep the compatibility. Why can't you? What exactly do we need to change? If we put things in terms of the balloon, that supports adding and removing pages. Using these terms, let's enumerate: - a new method (e.g. new virtqueue) that adds and immediately removes page in a balloon clearly, you can add then remove using the existing interfaces is a single command significantly faster than using existing two vqs? - a new kind of request that says "add (and immediately remove?) as many pages as you can" sounds rather benign - a new kind of message that adds multiple pages using a bitmap (instead of an address list) again, is this significantly faster? Does not look like compatibility is an issue, to me. At some level, your patches look like page hints. If we have more patches in mind that use page hints, then a new hint device might make sense. However, people experimented with page hints in the past, so far this always went nowhere. E.g. I CC Rick who saw some problems when page hints interact with huge pages. Rick, could you elaborate please? -- MST
[toc] | [prev] | [next] | [standalone]
| From | "Li, Liang Z" <liang.z.li@intel.com> |
|---|---|
| Date | 2016-03-07 16:10 +0100 |
| Message-ID | <ra4Xf-4ss-3@gated-at.bofh.it> |
| In reply to | #1351559 |
> Cc: Roman Kagan; Dr. David Alan Gilbert; ehabkost@redhat.com; > kvm@vger.kernel.org; quintela@redhat.com; linux-kernel@vger.kernel.org; > qemu-devel@nongnu.org; linux-mm@kvack.org; amit.shah@redhat.com; > pbonzini@redhat.com; akpm@linux-foundation.org; > virtualization@lists.linux-foundation.org; rth@twiddle.net; riel@redhat.com > Subject: Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration > optimization > > On Mon, Mar 07, 2016 at 06:49:19AM +0000, Li, Liang Z wrote: > > > > No. And it's exactly what I mean. The ballooned memory is still > > > > processed during live migration without skipping. The live > > > > migration code is > > > in migration/ram.c. > > > > > > So if guest acknowledged VIRTIO_BALLOON_F_MUST_TELL_HOST, we > can > > > teach qemu to skip these pages. > > > Want to write a patch to do this? > > > > > > > Yes, we really can teach qemu to skip these pages and it's not hard. > > The problem is the poor performance, this PV solution > > Balloon is always PV. And do not call patches solutions please. > OK. > > is aimed to make it more > > efficient and reduce the performance impact on guest. > > We need to get a bit beyond this. You are making multiple changes, it seems > to make sense to split it all up, and analyse each change separately. If you > don't this patchset will be stuck: as you have seen people aren't convinced it > actually helps with real workloads. > Really, changing the virtio spec must have good reasons. > > > > > > > > > > > > > The only advantage of ' inflating the balloon before live > > > > > > > > migration' is simple, > > > > > > > nothing more. > > > > > > > > > > > > > > That's a big advantage. Another one is that it does > > > > > > > something useful in real- world scenarios. > > > > > > > > > > > > > > > > > > > I don't think the heave performance impaction is something > > > > > > useful in real > > > > > world scenarios. > > > > > > > > > > > > Liang > > > > > > > Roman. > > > > > > > > > > So fix the performance then. You will have to try harder if you > > > > > want to convince people that the performance is due to bad > > > > > host/guest interface, and so we have to change *that*. > > > > > > > > > > > > > Actually, the PV solution is irrelevant with the balloon > > > > mechanism, I just use it to transfer information between host and > guest. > > > > I am not sure if I should implement a new virtio device, and I > > > > want to get the answer from the community. > > > > In this RFC patch, to make things simple, I choose to extend the > > > > virtio-balloon and use the extended interface to transfer the > > > > request and > > > free_page_bimap content. > > > > > > > > I am not intend to change the current virtio-balloon implementation. > > > > > > > > Liang > > > > > > And the answer would depend on the answer to my question above. > > > Does balloon need an interface passing page bitmaps around? > > > > Yes, I need a new interface. > > Possibly, but you will need to justify this at some level if you care about > upstreaming your patches. > > > > Does this speed up any operations? > > > > No, a new interface will not speed up anything, but it is the easiest way to > solve the compatibility issue. > > A bunch of new code is often easier to write than to figure out the old one, > but if we keep piling it up we'll end up with an unmaintainable mess. So we > are rather careful about adding new interfaces, and we try to make them > generic sometimes even at cost of slight inefficiencies. > > > > OTOH what if you use the regular balloon interface with your patches? > > > > > > > The regular balloon interfaces have their specific function and I can't use > them in my patches. > > If using these regular interface, I have to do a lot of changes to keep the > compatibility. > > Why can't you? > > What exactly do we need to change? > > If we put things in terms of the balloon, that supports adding and removing > pages. > > Using these terms, let's enumerate: > - a new method (e.g. new virtqueue) that adds and immediately removes > page in a balloon > clearly, you can add then remove using the existing interfaces > is a single command significantly faster than using existing two vqs? > - a new kind of request that says "add (and immediately remove?) as many > pages as you can" > sounds rather benign > - a new kind of message that adds multiple pages using a bitmap > (instead of an address list) > again, is this significantly faster? More of less faster because of less data traffic. I didn't measure this, I will do it and take a deep look at the way you suggest if we choose to make use of the virtio-balloon interface. > > Does not look like compatibility is an issue, to me. > > > At some level, your patches look like page hints. > If we have more patches in mind that use page hints, then a new hint device > might make sense. > Yes, I have ever considered to implement a new device, use the virtio-balloon to transfer the free pages information which is irrelevant with the balloon mechanism is some more or less confusing. > However, people experimented with page hints in the past, so far this always > went nowhere. E.g. I CC Rick who saw some problems when page hints > interact with huge pages. Rick, could you elaborate please? > Thanks a lot. Can't wait to know the problems. Liang > > -- > MST
[toc] | [prev] | [next] | [standalone]
| From | Roman Kagan <rkagan@virtuozzo.com> |
|---|---|
| Date | 2016-03-09 15:30 +0100 |
| Message-ID | <raNhE-DP-3@gated-at.bofh.it> |
| In reply to | #1351559 |
On Mon, Mar 07, 2016 at 01:40:06PM +0200, Michael S. Tsirkin wrote: > On Mon, Mar 07, 2016 at 06:49:19AM +0000, Li, Liang Z wrote: > > > > No. And it's exactly what I mean. The ballooned memory is still > > > > processed during live migration without skipping. The live migration code is > > > in migration/ram.c. > > > > > > So if guest acknowledged VIRTIO_BALLOON_F_MUST_TELL_HOST, we can > > > teach qemu to skip these pages. > > > Want to write a patch to do this? > > > > > > > Yes, we really can teach qemu to skip these pages and it's not hard. > > The problem is the poor performance, this PV solution > > Balloon is always PV. And do not call patches solutions please. > > > is aimed to make it more > > efficient and reduce the performance impact on guest. > > We need to get a bit beyond this. You are making multiple > changes, it seems to make sense to split it all up, and analyse each > change separately. Couldn't agree more. There are three stages in this optimization: 1) choosing which pages to skip 2) communicating them from guest to host 3) skip transferring uninteresting pages to the remote side on migration For (3) there seems to be a low-hanging fruit to amend migration/ram.c:iz_zero_range() to consult /proc/self/pagemap. This would work for guest RAM that hasn't been touched yet or which has been ballooned out. For (1) I've been trying to make a point that skipping clean pages is much more likely to result in noticable benefit than free pages only. As for (2), we do seem to have a problem with the existing balloon: according to your measurements it's very slow; besides, I guess it plays badly with transparent huge pages (as both the guest and the host work with one 4k page at a time). This is a problem for other use cases of balloon (e.g. as a facility for resource management); tackling that appears a more natural application for optimization efforts. Thanks, Roman.
[toc] | [prev] | [next] | [standalone]
| From | "Li, Liang Z" <liang.z.li@intel.com> |
|---|---|
| Date | 2016-03-09 16:30 +0100 |
| Message-ID | <raOdI-1eq-11@gated-at.bofh.it> |
| In reply to | #1354167 |
> On Mon, Mar 07, 2016 at 01:40:06PM +0200, Michael S. Tsirkin wrote: > > On Mon, Mar 07, 2016 at 06:49:19AM +0000, Li, Liang Z wrote: > > > > > No. And it's exactly what I mean. The ballooned memory is still > > > > > processed during live migration without skipping. The live > > > > > migration code is > > > > in migration/ram.c. > > > > > > > > So if guest acknowledged VIRTIO_BALLOON_F_MUST_TELL_HOST, we > can > > > > teach qemu to skip these pages. > > > > Want to write a patch to do this? > > > > > > > > > > Yes, we really can teach qemu to skip these pages and it's not hard. > > > The problem is the poor performance, this PV solution > > > > Balloon is always PV. And do not call patches solutions please. > > > > > is aimed to make it more > > > efficient and reduce the performance impact on guest. > > > > We need to get a bit beyond this. You are making multiple changes, it > > seems to make sense to split it all up, and analyse each change > > separately. > > Couldn't agree more. > > There are three stages in this optimization: > > 1) choosing which pages to skip > > 2) communicating them from guest to host > > 3) skip transferring uninteresting pages to the remote side on migration > > For (3) there seems to be a low-hanging fruit to amend > migration/ram.c:iz_zero_range() to consult /proc/self/pagemap. This would > work for guest RAM that hasn't been touched yet or which has been > ballooned out. > > For (1) I've been trying to make a point that skipping clean pages is much > more likely to result in noticable benefit than free pages only. > I am considering to drop the pagecache before getting the free pages. > As for (2), we do seem to have a problem with the existing balloon: > according to your measurements it's very slow; besides, I guess it plays badly I didn't say communicating is slow. Even this is very slow, my solution use bitmap instead of PFNs, there is fewer data traffic, so it's faster than the existing balloon which use PFNs. > with transparent huge pages (as both the guest and the host work with one > 4k page at a time). This is a problem for other use cases of balloon (e.g. as a > facility for resource management); tackling that appears a more natural > application for optimization efforts. > > Thanks, > Roman.
[toc] | [prev] | [next] | [standalone]
| From | "Michael S. Tsirkin" <mst@redhat.com> |
|---|---|
| Date | 2016-03-09 16:40 +0100 |
| Message-ID | <raOno-1of-17@gated-at.bofh.it> |
| In reply to | #1354214 |
On Wed, Mar 09, 2016 at 03:27:54PM +0000, Li, Liang Z wrote: > > On Mon, Mar 07, 2016 at 01:40:06PM +0200, Michael S. Tsirkin wrote: > > > On Mon, Mar 07, 2016 at 06:49:19AM +0000, Li, Liang Z wrote: > > > > > > No. And it's exactly what I mean. The ballooned memory is still > > > > > > processed during live migration without skipping. The live > > > > > > migration code is > > > > > in migration/ram.c. > > > > > > > > > > So if guest acknowledged VIRTIO_BALLOON_F_MUST_TELL_HOST, we > > can > > > > > teach qemu to skip these pages. > > > > > Want to write a patch to do this? > > > > > > > > > > > > > Yes, we really can teach qemu to skip these pages and it's not hard. > > > > The problem is the poor performance, this PV solution > > > > > > Balloon is always PV. And do not call patches solutions please. > > > > > > > is aimed to make it more > > > > efficient and reduce the performance impact on guest. > > > > > > We need to get a bit beyond this. You are making multiple changes, it > > > seems to make sense to split it all up, and analyse each change > > > separately. > > > > Couldn't agree more. > > > > There are three stages in this optimization: > > > > 1) choosing which pages to skip > > > > 2) communicating them from guest to host > > > > 3) skip transferring uninteresting pages to the remote side on migration > > > > For (3) there seems to be a low-hanging fruit to amend > > migration/ram.c:iz_zero_range() to consult /proc/self/pagemap. This would > > work for guest RAM that hasn't been touched yet or which has been > > ballooned out. > > > > For (1) I've been trying to make a point that skipping clean pages is much > > more likely to result in noticable benefit than free pages only. > > > > I am considering to drop the pagecache before getting the free pages. > > > As for (2), we do seem to have a problem with the existing balloon: > > according to your measurements it's very slow; besides, I guess it plays badly > > I didn't say communicating is slow. Even this is very slow, my solution use bitmap instead of > PFNs, there is fewer data traffic, so it's faster than the existing balloon which use PFNs. By how much? > > with transparent huge pages (as both the guest and the host work with one > > 4k page at a time). This is a problem for other use cases of balloon (e.g. as a > > facility for resource management); tackling that appears a more natural > > application for optimization efforts. > > > > Thanks, > > Roman.
[toc] | [prev] | [next] | [standalone]
| From | "Li, Liang Z" <liang.z.li@intel.com> |
|---|---|
| Date | 2016-03-10 02:50 +0100 |
| Message-ID | <raXTI-8c6-3@gated-at.bofh.it> |
| In reply to | #1354220 |
> > > > > Yes, we really can teach qemu to skip these pages and it's not hard. > > > > > The problem is the poor performance, this PV solution > > > > > > > > Balloon is always PV. And do not call patches solutions please. > > > > > > > > > is aimed to make it more > > > > > efficient and reduce the performance impact on guest. > > > > > > > > We need to get a bit beyond this. You are making multiple > > > > changes, it seems to make sense to split it all up, and analyse > > > > each change separately. > > > > > > Couldn't agree more. > > > > > > There are three stages in this optimization: > > > > > > 1) choosing which pages to skip > > > > > > 2) communicating them from guest to host > > > > > > 3) skip transferring uninteresting pages to the remote side on > > > migration > > > > > > For (3) there seems to be a low-hanging fruit to amend > > > migration/ram.c:iz_zero_range() to consult /proc/self/pagemap. This > > > would work for guest RAM that hasn't been touched yet or which has > > > been ballooned out. > > > > > > For (1) I've been trying to make a point that skipping clean pages > > > is much more likely to result in noticable benefit than free pages only. > > > > > > > I am considering to drop the pagecache before getting the free pages. > > > > > As for (2), we do seem to have a problem with the existing balloon: > > > according to your measurements it's very slow; besides, I guess it > > > plays badly > > > > I didn't say communicating is slow. Even this is very slow, my > > solution use bitmap instead of PFNs, there is fewer data traffic, so it's > faster than the existing balloon which use PFNs. > > By how much? > Haven't measured yet. To identify a page, 1 bit is needed if using bitmap, 4 Bytes(32bit) is needed if using PFN, For a guest with 8GB RAM, the corresponding free page bitmap size is 256KB. And the corresponding total PFNs size is 8192KB. Assuming the inflating size is 7GB, the total PFNs size is 7168KB. Maybe this is not the point. Liang > > > with transparent huge pages (as both the guest and the host work > > > with one 4k page at a time). This is a problem for other use cases > > > of balloon (e.g. as a facility for resource management); tackling > > > that appears a more natural application for optimization efforts. > > > > > > Thanks, > > > Roman.
[toc] | [prev] | [next] | [standalone]
| From | "Michael S. Tsirkin" <mst@redhat.com> |
|---|---|
| Date | 2016-03-10 13:30 +0100 |
| Message-ID | <rb7T4-6WL-15@gated-at.bofh.it> |
| In reply to | #1354737 |
On Thu, Mar 10, 2016 at 01:41:16AM +0000, Li, Liang Z wrote: > > > > > > Yes, we really can teach qemu to skip these pages and it's not hard. > > > > > > The problem is the poor performance, this PV solution > > > > > > > > > > Balloon is always PV. And do not call patches solutions please. > > > > > > > > > > > is aimed to make it more > > > > > > efficient and reduce the performance impact on guest. > > > > > > > > > > We need to get a bit beyond this. You are making multiple > > > > > changes, it seems to make sense to split it all up, and analyse > > > > > each change separately. > > > > > > > > Couldn't agree more. > > > > > > > > There are three stages in this optimization: > > > > > > > > 1) choosing which pages to skip > > > > > > > > 2) communicating them from guest to host > > > > > > > > 3) skip transferring uninteresting pages to the remote side on > > > > migration > > > > > > > > For (3) there seems to be a low-hanging fruit to amend > > > > migration/ram.c:iz_zero_range() to consult /proc/self/pagemap. This > > > > would work for guest RAM that hasn't been touched yet or which has > > > > been ballooned out. > > > > > > > > For (1) I've been trying to make a point that skipping clean pages > > > > is much more likely to result in noticable benefit than free pages only. > > > > > > > > > > I am considering to drop the pagecache before getting the free pages. > > > > > > > As for (2), we do seem to have a problem with the existing balloon: > > > > according to your measurements it's very slow; besides, I guess it > > > > plays badly > > > > > > I didn't say communicating is slow. Even this is very slow, my > > > solution use bitmap instead of PFNs, there is fewer data traffic, so it's > > faster than the existing balloon which use PFNs. > > > > By how much? > > > > Haven't measured yet. > To identify a page, 1 bit is needed if using bitmap, 4 Bytes(32bit) is needed if using PFN, > > For a guest with 8GB RAM, the corresponding free page bitmap size is 256KB. > And the corresponding total PFNs size is 8192KB. Assuming the inflating size > is 7GB, the total PFNs size is 7168KB. Yes but this is not how balloon works, instead, it will reuse a single 4K page multiple times. We can also trade off more memory for speed if we want to, it's completely up to guest. > > Maybe this is not the point. > > Liang > > > > with transparent huge pages (as both the guest and the host work > > > > with one 4k page at a time). This is a problem for other use cases > > > > of balloon (e.g. as a facility for resource management); tackling > > > > that appears a more natural application for optimization efforts. > > > > > > > > Thanks, > > > > Roman.
[toc] | [prev] | [next] | [standalone]
| From | "Michael S. Tsirkin" <mst@redhat.com> |
|---|---|
| Date | 2016-03-09 16:50 +0100 |
| Message-ID | <raOx3-1ry-3@gated-at.bofh.it> |
| In reply to | #1354167 |
On Wed, Mar 09, 2016 at 05:28:54PM +0300, Roman Kagan wrote: > On Mon, Mar 07, 2016 at 01:40:06PM +0200, Michael S. Tsirkin wrote: > > On Mon, Mar 07, 2016 at 06:49:19AM +0000, Li, Liang Z wrote: > > > > > No. And it's exactly what I mean. The ballooned memory is still > > > > > processed during live migration without skipping. The live migration code is > > > > in migration/ram.c. > > > > > > > > So if guest acknowledged VIRTIO_BALLOON_F_MUST_TELL_HOST, we can > > > > teach qemu to skip these pages. > > > > Want to write a patch to do this? > > > > > > > > > > Yes, we really can teach qemu to skip these pages and it's not hard. > > > The problem is the poor performance, this PV solution > > > > Balloon is always PV. And do not call patches solutions please. > > > > > is aimed to make it more > > > efficient and reduce the performance impact on guest. > > > > We need to get a bit beyond this. You are making multiple > > changes, it seems to make sense to split it all up, and analyse each > > change separately. > > Couldn't agree more. > > There are three stages in this optimization: > > 1) choosing which pages to skip > > 2) communicating them from guest to host > > 3) skip transferring uninteresting pages to the remote side on migration > > For (3) there seems to be a low-hanging fruit to amend > migration/ram.c:iz_zero_range() to consult /proc/self/pagemap. This > would work for guest RAM that hasn't been touched yet or which has been > ballooned out. > > For (1) I've been trying to make a point that skipping clean pages is > much more likely to result in noticable benefit than free pages only. I guess when you say clean you mean zero? Yea. In fact, one can zero out any number of pages quickly by putting them in balloon and immediately taking them out. Access will fault a zero page in, then COW kicks in. We could have a new zero VQ (or some other option) to pass these pages guest to host, but this only works well if page size matches the host page size. > As for (2), we do seem to have a problem with the existing balloon: > according to your measurements it's very slow; besides, I guess it plays > badly with transparent huge pages (as both the guest and the host work > with one 4k page at a time). This is a problem for other use cases of > balloon (e.g. as a facility for resource management); tackling that > appears a more natural application for optimization efforts. > > Thanks, > Roman.
[toc] | [prev] | [next] | [standalone]
| From | Roman Kagan <rkagan@virtuozzo.com> |
|---|---|
| Date | 2016-03-09 18:10 +0100 |
| Message-ID | <raPMu-2zP-3@gated-at.bofh.it> |
| In reply to | #1354231 |
On Wed, Mar 09, 2016 at 05:41:39PM +0200, Michael S. Tsirkin wrote: > On Wed, Mar 09, 2016 at 05:28:54PM +0300, Roman Kagan wrote: > > For (1) I've been trying to make a point that skipping clean pages is > > much more likely to result in noticable benefit than free pages only. > > I guess when you say clean you mean zero? No I meant clean, i.e. those that could be evicted from RAM without causing I/O. > Yea. In fact, one can zero out any number of pages > quickly by putting them in balloon and immediately > taking them out. > > Access will fault a zero page in, then COW kicks in. I must be missing something obvious, but how is that different from inflating and then immediately deflating the balloon? > We could have a new zero VQ (or some other option) > to pass these pages guest to host, but this only > works well if page size matches the host page size. I'm afraid I don't yet understand what kind of pages that would be and how they are different from ballooned pages. I still tend to think that ballooning is a sensible solution to the problem at hand; it's just the granularity that makes things slow and stands in the way. Roman.
[toc] | [prev] | [next] | [standalone]
| From | "Michael S. Tsirkin" <mst@redhat.com> |
|---|---|
| Date | 2016-03-09 18:40 +0100 |
| Message-ID | <raQfx-2Q2-29@gated-at.bofh.it> |
| In reply to | #1354279 |
On Wed, Mar 09, 2016 at 08:04:39PM +0300, Roman Kagan wrote: > On Wed, Mar 09, 2016 at 05:41:39PM +0200, Michael S. Tsirkin wrote: > > On Wed, Mar 09, 2016 at 05:28:54PM +0300, Roman Kagan wrote: > > > For (1) I've been trying to make a point that skipping clean pages is > > > much more likely to result in noticable benefit than free pages only. > > > > I guess when you say clean you mean zero? > > No I meant clean, i.e. those that could be evicted from RAM without > causing I/O. They must be migrated unless guest actually evicts them. It's not at all clear to me that it's always preferable to drop all clean pages from pagecache. It is clearly is going to slow the guest down significantly. > > Yea. In fact, one can zero out any number of pages > > quickly by putting them in balloon and immediately > > taking them out. > > > > Access will fault a zero page in, then COW kicks in. > > I must be missing something obvious, but how is that different from > inflating and then immediately deflating the balloon? It's exactly the same except - we do not initiate this from host - it's guest doing things for its own reasons - a bit less guest/host interaction this way > > We could have a new zero VQ (or some other option) > > to pass these pages guest to host, but this only > > works well if page size matches the host page size. > > I'm afraid I don't yet understand what kind of pages that would be and > how they are different from ballooned pages. > > I still tend to think that ballooning is a sensible solution to the > problem at hand; I think it is, too. This does not mean we can't improve things though. This patchset is reported to improve things, it should be split up so we improve them for everyone and not just one specific workload. > it's just the granularity that makes things slow and > stands in the way. So we could request a specific page size/alignment from guest. Send guest request to give us memory in aligned units of 2Mbytes, and then host can treat each of these as a single huge page. > Roman. -- MST
[toc] | [prev] | [next] | [standalone]
| From | Roman Kagan <rkagan@virtuozzo.com> |
|---|---|
| Date | 2016-03-10 11:30 +0100 |
| Message-ID | <rb60W-5G6-21@gated-at.bofh.it> |
| In reply to | #1354308 |
On Wed, Mar 09, 2016 at 07:39:18PM +0200, Michael S. Tsirkin wrote: > On Wed, Mar 09, 2016 at 08:04:39PM +0300, Roman Kagan wrote: > > On Wed, Mar 09, 2016 at 05:41:39PM +0200, Michael S. Tsirkin wrote: > > > On Wed, Mar 09, 2016 at 05:28:54PM +0300, Roman Kagan wrote: > > > > For (1) I've been trying to make a point that skipping clean pages is > > > > much more likely to result in noticable benefit than free pages only. > > > > > > I guess when you say clean you mean zero? > > > > No I meant clean, i.e. those that could be evicted from RAM without > > causing I/O. > > They must be migrated unless guest actually evicts them. If the balloon is inflated the guest will. > It's not at all clear to me that it's always preferable > to drop all clean pages from pagecache. It is clearly is > going to slow the guest down significantly. That's a matter for optimization. The current value for /proc/meminfo:MemAvailable (which is being proposed as a member of balloon stats, too) is a conservative estimate which will probably cover a good deal of cases. > > I must be missing something obvious, but how is that different from > > inflating and then immediately deflating the balloon? > > It's exactly the same except > - we do not initiate this from host - it's guest doing > things for its own reasons > - a bit less guest/host interaction this way I don't quite understand why you need to deflate the balloon until the VM is on the destination host. deflate_on_oom will do it if the guest is really tight on memory; otherwise there appears to be no reason for it. But then inflation followed immediately by deflation doubles the guest/host interactions rather than reduces them, no? > > it's just the granularity that makes things slow and > > stands in the way. > > So we could request a specific page size/alignment from guest. > Send guest request to give us memory in aligned units of 2Mbytes, > and then host can treat each of these as a single huge page. I'd guess just coalescing contiguous pages would already speed things up. I'll try to find some time to experiment with it. Roman.
[toc] | [prev] | [next] | [standalone]
| From | Rik van Riel <riel@redhat.com> |
|---|---|
| Date | 2016-03-09 20:40 +0100 |
| Message-ID | <raS7E-44y-9@gated-at.bofh.it> |
| In reply to | #1354279 |
[Multipart message — attachments visible in raw view] — view raw
On Wed, 2016-03-09 at 20:04 +0300, Roman Kagan wrote: > On Wed, Mar 09, 2016 at 05:41:39PM +0200, Michael S. Tsirkin wrote: > > On Wed, Mar 09, 2016 at 05:28:54PM +0300, Roman Kagan wrote: > > > For (1) I've been trying to make a point that skipping clean > > > pages is > > > much more likely to result in noticable benefit than free pages > > > only. > > > > I guess when you say clean you mean zero? > > No I meant clean, i.e. those that could be evicted from RAM without > causing I/O. > Programs in the guest may have that memory mmapped. This could include things like libraries and executables. How do you deal with the guest page cache containing references to now non-existent memory? How do you re-populate the memory on the destination host? -- All rights reversed
[toc] | [prev] | [next] | [standalone]
| From | Roman Kagan <rkagan@virtuozzo.com> |
|---|---|
| Date | 2016-03-10 10:40 +0100 |
| Message-ID | <rb5ex-4U1-11@gated-at.bofh.it> |
| In reply to | #1354386 |
On Wed, Mar 09, 2016 at 02:38:52PM -0500, Rik van Riel wrote: > On Wed, 2016-03-09 at 20:04 +0300, Roman Kagan wrote: > > On Wed, Mar 09, 2016 at 05:41:39PM +0200, Michael S. Tsirkin wrote: > > > On Wed, Mar 09, 2016 at 05:28:54PM +0300, Roman Kagan wrote: > > > > For (1) I've been trying to make a point that skipping clean > > > > pages is > > > > much more likely to result in noticable benefit than free pages > > > > only. > > > > > > I guess when you say clean you mean zero? > > > > No I meant clean, i.e. those that could be evicted from RAM without > > causing I/O. > > > > Programs in the guest may have that memory mmapped. > This could include things like libraries and executables. > > How do you deal with the guest page cache containing > references to now non-existent memory? > > How do you re-populate the memory on the destination > host? I guess the confusion is due to the context I stripped from the previous messages... Actually I've been talking about doing full-fledged balloon inflation before the migration, so, when it's deflated the guest will fault in that data from the filesystem as usual. Roman.
[toc] | [prev] | [next] | [standalone]
| From | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| Date | 2016-03-04 17:30 +0100 |
| Message-ID | <r90M2-Y1-17@gated-at.bofh.it> |
| In reply to | #1350256 |
On 04/03/2016 15:26, Li, Liang Z wrote: >> > >> > The memory usage will keep increasing due to ever growing caches, etc, so >> > you'll be left with very little free memory fairly soon. >> > > I don't think so. > Roman is right. For example, here I am looking at a 64 GB (physical) machine which was booted about 30 minutes ago, and which is running disk-heavy workloads (installing VMs). Since I have started writing this email (2 minutes?), the amount of free memory has already gone down from 37 GB to 33 GB. I expect that by the time I have finished running the workload, in two hours, it will not have any free memory. Paolo
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | linux.kernel
csiph-web