Re: [PATCH kernel v8 3/4] mm: add inerface to offer info about unused pages

From: Michael S. Tsirkin
Date: Thu Mar 16 2017 - 21:24:24 EST


On Thu, Mar 16, 2017 at 03:08:46PM +0800, Wei Wang wrote:
> +/*
> + * The record_unused_pages() function is used to record the system unused
> + * pages. The unused pages can be skipped to transfer during live migration.
> + * Though the unused pages are dynamically changing, dirty page logging
> + * mechanisms are able to capture the newly used pages though they were
> + * recorded as unused pages via this function.

You will keep confusing people as long as you keep using
this terminology which only makes sense in a very specific
use and a very specific implementation.

How does guest developer know this does the right thing wrt locking etc?
Look at hypervisor spec and try to figure it all out together?

So stop saying what caller should do, describe what does the *API* does.

You want something like this:

Get a list of pages in the system that are unused at some point between
record_unused_pages is called and before it returns, implying that any
data that was present in these pages before record_unused_pages was
called is safe to discard. Pages can be used immediately after
this point and any data written after this point is not safe to discard,
it is caller's responsibility to either prevent the use or
detect such pages.

--
MST