Commit 13fb2c44 authored by David Hildenbrand's avatar David Hildenbrand Committed by Stephen Rothwell

vmw_balloon-mark-inflated-pages-pg_offline-v2

use vmballoon_page_in_frames more widely

Link: http://lkml.kernel.org/r/20181122100627.5189-7-david@redhat.comSigned-off-by: default avatarDavid Hildenbrand <david@redhat.com>
Acked-by: default avatarNadav Amit <namit@vmware.com>
Cc: Xavier Deguillard <xdeguillard@vmware.com>
Cc: Nadav Amit <namit@vmware.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Julien Freche <jfreche@vmware.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Christian Hansen <chansen3@cisco.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Juergen Gross <jgross@suse.com>
Cc: Kairui Song <kasong@redhat.com>
Cc: Kazuhito Hagio <k-hagio@ab.jp.nec.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Lianbo Jiang <lijiang@redhat.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Miles Chen <miles.chen@mediatek.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Omar Sandoval <osandov@fb.com>
Cc: Pankaj gupta <pagupta@redhat.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Pavel Tatashin <pasha.tatashin@oracle.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
parent c4735cd1
......@@ -544,9 +544,21 @@ unsigned int vmballoon_page_order(enum vmballoon_page_size_type page_size)
return page_size == VMW_BALLOON_2M_PAGE ? VMW_BALLOON_2M_ORDER : 0;
}
/**
* vmballoon_page_in_frames() - returns the number of frames in a page.
* @page_size: the size of the page.
*
* Return: the number of 4k frames.
*/
static inline unsigned int
vmballoon_page_in_frames(enum vmballoon_page_size_type page_size)
{
return 1 << vmballoon_page_order(page_size);
}
/**
* vmballoon_mark_page_offline() - mark a page as offline
* @page: pointer for the page
* @page: pointer for the page.
* @page_size: the size of the page.
*/
static void
......@@ -555,13 +567,13 @@ vmballoon_mark_page_offline(struct page *page,
{
int i;
for (i = 0; i < 1ULL << vmballoon_page_order(page_size); i++)
for (i = 0; i < vmballoon_page_in_frames(page_size); i++)
__SetPageOffline(page + i);
}
/**
* vmballoon_mark_page_online() - mark a page as online
* @page: pointer for the page
* @page: pointer for the page.
* @page_size: the size of the page.
*/
static void
......@@ -570,22 +582,10 @@ vmballoon_mark_page_online(struct page *page,
{
int i;
for (i = 0; i < 1ULL << vmballoon_page_order(page_size); i++)
for (i = 0; i < vmballoon_page_in_frames(page_size); i++)
__ClearPageOffline(page + i);
}
/**
* vmballoon_page_in_frames() - returns the number of frames in a page.
* @page_size: the size of the page.
*
* Return: the number of 4k frames.
*/
static inline unsigned int
vmballoon_page_in_frames(enum vmballoon_page_size_type page_size)
{
return 1 << vmballoon_page_order(page_size);
}
/**
* vmballoon_send_get_target() - Retrieve desired balloon size from the host.
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment