linux/drivers/misc/vmw_balloon.c
/*
 * Notify the host of a ballooned page. If host rejects the page put it on the
 * refuse list, those refused page are then released at the end of the
 * inflation cycle.
 */
Notify the host of a ballooned page. If host rejects the page put it on the
refuse list, those refused page are then released at the end of the
inflation cycle.
Notify the host of a ballooned page . If host rejects the page put it on the refuse list those refused page are then released at the end of the inflation cycle .
static int vmballoon_lock_page(struct vmballoon *b, unsigned int num_pages,
				bool is_2m_pages, unsigned int *target)
{
	int locked, hv_status;
	struct page *page = b->page;
	struct vmballoon_page_size *page_size = &b->page_sizes[false];
	locked = vmballoon_send_lock_page(b, page_to_pfn(page), &hv_status,
								target);
	if (locked) {
		STATS_INC(b->stats.refused_alloc[false]);
		if (locked == -EIO &&
		    (hv_status == VMW_BALLOON_ERROR_RESET ||
		     hv_status == VMW_BALLOON_ERROR_PPN_NOTNEEDED)) {
			vmballoon_free_page(page, false);
			return -EIO;
		}
		if (page_size->n_refused_pages < VMW_BALLOON_MAX_REFUSED) {
			page_size->n_refused_pages++;
			list_add(&page->lru, &page_size->refused_pages);
		} else {
			vmballoon_free_page(page, false);
		}
		return locked;
	}
	list_add(&page->lru, &page_size->pages);
	b->size++;
	return 0;
}
static int vmballoon_lock_page ( struct vmballoon * b , unsigned int num_pages , bool is_2m_pages , unsigned int * target ) { int locked , hv_status ; struct page * page = b -> page ; struct vmballoon_page_size * page_size = & b -> page_sizes [ false ] ; locked = vmballoon_send_lock_page ( b , page_to_pfn ( page ) , & hv_status , target ) ; if ( locked ) { STATS_INC ( b -> stats . refused_alloc [ false ] ) ; if ( locked == - EIO && ( hv_status == VMW_BALLOON_ERROR_RESET || hv_status == VMW_BALLOON_ERROR_PPN_NOTNEEDED ) ) { vmballoon_free_page ( page , false ) ; return - EIO ; } if ( page_size -> n_refused_pages < VMW_BALLOON_MAX_REFUSED ) { page_size -> n_refused_pages ++ ; list_add ( & page -> lru , & page_size -> refused_pages ) ; } else { vmballoon_free_page ( page , false ) ; } return locked ; } list_add ( & page -> lru , & page_size -> pages ) ; b -> size ++ ; return 0 ; }
Notify the host of a ballooned page.
Notify the host of a ballooned page .
/* is_2m_pages can never happen as 2m pages support implies batching */ /*
		 * Place page on the list of non-balloonable pages
		 * and retry allocation, unless we already accumulated
		 * too many of them, in which case take a breather.
		 */ /* track allocated page */ /* update balloon size */