1
0
Fork 0

balloon: fix up comments

Lots of comments bitrotted. Fix them up.

Fixes: 418a3ab1e7 (mm/balloon_compaction: List interfaces)
Reviewed-by: Wei Wang <wei.w.wang@intel.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
Acked-by: Nadav Amit <namit@vmware.com>
alistair/sunxi64-5.4-dsi
Michael S. Tsirkin 2019-07-18 08:19:24 -04:00
parent dd42290679
commit cfe61801b0
1 changed files with 37 additions and 30 deletions

View File

@ -32,8 +32,8 @@ static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info,
* @b_dev_info: balloon device descriptor where we will insert a new page to * @b_dev_info: balloon device descriptor where we will insert a new page to
* @pages: pages to enqueue - allocated using balloon_page_alloc. * @pages: pages to enqueue - allocated using balloon_page_alloc.
* *
* Driver must call it to properly enqueue a balloon pages before definitively * Driver must call this function to properly enqueue balloon pages before
* removing it from the guest system. * definitively removing them from the guest system.
* *
* Return: number of pages that were enqueued. * Return: number of pages that were enqueued.
*/ */
@ -63,12 +63,13 @@ EXPORT_SYMBOL_GPL(balloon_page_list_enqueue);
* @n_req_pages: number of requested pages. * @n_req_pages: number of requested pages.
* *
* Driver must call this function to properly de-allocate a previous enlisted * Driver must call this function to properly de-allocate a previous enlisted
* balloon pages before definetively releasing it back to the guest system. * balloon pages before definitively releasing it back to the guest system.
* This function tries to remove @n_req_pages from the ballooned pages and * This function tries to remove @n_req_pages from the ballooned pages and
* return them to the caller in the @pages list. * return them to the caller in the @pages list.
* *
* Note that this function may fail to dequeue some pages temporarily empty due * Note that this function may fail to dequeue some pages even if the balloon
* to compaction isolated pages. * isn't empty - since the page list can be temporarily empty due to compaction
* of isolated pages.
* *
* Return: number of pages that were added to the @pages list. * Return: number of pages that were added to the @pages list.
*/ */
@ -112,12 +113,13 @@ EXPORT_SYMBOL_GPL(balloon_page_list_dequeue);
/* /*
* balloon_page_alloc - allocates a new page for insertion into the balloon * balloon_page_alloc - allocates a new page for insertion into the balloon
* page list. * page list.
* *
* Driver must call it to properly allocate a new enlisted balloon page. * Driver must call this function to properly allocate a new balloon page.
* Driver must call balloon_page_enqueue before definitively removing it from * Driver must call balloon_page_enqueue before definitively removing the page
* the guest system. This function returns the page address for the recently * from the guest system.
* allocated page or NULL in the case we fail to allocate a new page this turn. *
* Return: struct page for the allocated page or NULL on allocation failure.
*/ */
struct page *balloon_page_alloc(void) struct page *balloon_page_alloc(void)
{ {
@ -130,19 +132,15 @@ EXPORT_SYMBOL_GPL(balloon_page_alloc);
/* /*
* balloon_page_enqueue - inserts a new page into the balloon page list. * balloon_page_enqueue - inserts a new page into the balloon page list.
* *
* @b_dev_info: balloon device descriptor where we will insert a new page to * @b_dev_info: balloon device descriptor where we will insert a new page
* @page: new page to enqueue - allocated using balloon_page_alloc. * @page: new page to enqueue - allocated using balloon_page_alloc.
* *
* Driver must call it to properly enqueue a new allocated balloon page * Drivers must call this function to properly enqueue a new allocated balloon
* before definitively removing it from the guest system. * page before definitively removing the page from the guest system.
* *
* Drivers must not call balloon_page_enqueue on pages that have been * Drivers must not call balloon_page_enqueue on pages that have been pushed to
* pushed to a list with balloon_page_push before removing them with * a list with balloon_page_push before removing them with balloon_page_pop. To
* balloon_page_pop. To all pages on a list, use balloon_page_list_enqueue * enqueue a list of pages, use balloon_page_list_enqueue instead.
* instead.
*
* This function returns the page address for the recently enqueued page or
* NULL in the case we fail to allocate a new page this turn.
*/ */
void balloon_page_enqueue(struct balloon_dev_info *b_dev_info, void balloon_page_enqueue(struct balloon_dev_info *b_dev_info,
struct page *page) struct page *page)
@ -157,14 +155,23 @@ EXPORT_SYMBOL_GPL(balloon_page_enqueue);
/* /*
* balloon_page_dequeue - removes a page from balloon's page list and returns * balloon_page_dequeue - removes a page from balloon's page list and returns
* the its address to allow the driver release the page. * its address to allow the driver to release the page.
* @b_dev_info: balloon device decriptor where we will grab a page from. * @b_dev_info: balloon device decriptor where we will grab a page from.
* *
* Driver must call it to properly de-allocate a previous enlisted balloon page * Driver must call this function to properly dequeue a previously enqueued page
* before definetively releasing it back to the guest system. * before definitively releasing it back to the guest system.
* This function returns the page address for the recently dequeued page or *
* NULL in the case we find balloon's page list temporarily empty due to * Caller must perform its own accounting to ensure that this
* compaction isolated pages. * function is called only if some pages are actually enqueued.
*
* Note that this function may fail to dequeue some pages even if there are
* some enqueued pages - since the page list can be temporarily empty due to
* the compaction of isolated pages.
*
* TODO: remove the caller accounting requirements, and allow caller to wait
* until all pages can be dequeued.
*
* Return: struct page for the dequeued page, or NULL if no page was dequeued.
*/ */
struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info) struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info)
{ {
@ -177,9 +184,9 @@ struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info)
if (n_pages != 1) { if (n_pages != 1) {
/* /*
* If we are unable to dequeue a balloon page because the page * If we are unable to dequeue a balloon page because the page
* list is empty and there is no isolated pages, then something * list is empty and there are no isolated pages, then something
* went out of track and some balloon pages are lost. * went out of track and some balloon pages are lost.
* BUG() here, otherwise the balloon driver may get stuck into * BUG() here, otherwise the balloon driver may get stuck in
* an infinite loop while attempting to release all its pages. * an infinite loop while attempting to release all its pages.
*/ */
spin_lock_irqsave(&b_dev_info->pages_lock, flags); spin_lock_irqsave(&b_dev_info->pages_lock, flags);
@ -230,8 +237,8 @@ int balloon_page_migrate(struct address_space *mapping,
/* /*
* We can not easily support the no copy case here so ignore it as it * We can not easily support the no copy case here so ignore it as it
* is unlikely to be use with ballon pages. See include/linux/hmm.h for * is unlikely to be used with balloon pages. See include/linux/hmm.h
* user of the MIGRATE_SYNC_NO_COPY mode. * for a user of the MIGRATE_SYNC_NO_COPY mode.
*/ */
if (mode == MIGRATE_SYNC_NO_COPY) if (mode == MIGRATE_SYNC_NO_COPY)
return -EINVAL; return -EINVAL;