[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v15 4/5] mm: support reporting free page blocks
From: |
Michal Hocko |
Subject: |
Re: [Qemu-devel] [PATCH v15 4/5] mm: support reporting free page blocks |
Date: |
Mon, 28 Aug 2017 16:09:58 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Mon 28-08-17 15:33:26, Michal Hocko wrote:
> On Mon 28-08-17 18:08:32, Wei Wang wrote:
> > This patch adds support to walk through the free page blocks in the
> > system and report them via a callback function. Some page blocks may
> > leave the free list after zone->lock is released, so it is the caller's
> > responsibility to either detect or prevent the use of such pages.
> >
> > One use example of this patch is to accelerate live migration by skipping
> > the transfer of free pages reported from the guest. A popular method used
> > by the hypervisor to track which part of memory is written during live
> > migration is to write-protect all the guest memory. So, those pages that
> > are reported as free pages but are written after the report function
> > returns will be captured by the hypervisor, and they will be added to the
> > next round of memory transfer.
>
> OK, looks much better. I still have few nits.
>
> > +extern void walk_free_mem_block(void *opaque,
> > + int min_order,
> > + bool (*report_page_block)(void *, unsigned long,
> > + unsigned long));
> > +
>
> please add names to arguments of the prototype
And one more thing. Your callback returns bool and true usually means a
success while you are using it to break out from the loop. This is
rather confusing. I would expect iterating until false is returned so
the opposite than what you have. You could also change this to int and
return 0 on success and < 0 to break out.
--
Michal Hocko
SUSE Labs
- [Qemu-devel] [PATCH v15 0/5] Virtio-balloon Enhancement, Wei Wang, 2017/08/28
- [Qemu-devel] [PATCH v15 2/5] lib/xbitmap: add xb_find_next_bit() and xb_zero(), Wei Wang, 2017/08/28
- [Qemu-devel] [PATCH v15 1/5] lib/xbitmap: Introduce xbitmap, Wei Wang, 2017/08/28
- [Qemu-devel] [PATCH v15 3/5] virtio-balloon: VIRTIO_BALLOON_F_SG, Wei Wang, 2017/08/28
- [Qemu-devel] [PATCH v15 4/5] mm: support reporting free page blocks, Wei Wang, 2017/08/28
- [Qemu-devel] [PATCH v15 5/5] virtio-balloon: VIRTIO_BALLOON_F_CTRL_VQ, Wei Wang, 2017/08/28