]> www.infradead.org Git - users/willy/linux.git/commitdiff
vmw_balloon-mark-inflated-pages-pg_offline-v2
authorDavid Hildenbrand <david@redhat.com>
Wed, 5 Dec 2018 00:14:22 +0000 (11:14 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 10 Dec 2018 08:29:16 +0000 (19:29 +1100)
use vmballoon_page_in_frames more widely

Link: http://lkml.kernel.org/r/20181122100627.5189-7-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Nadav 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
drivers/misc/vmw_balloon.c

index a6c7e04e4aa5b3076c882cd03c04aa65a5eace65..869ec842729efd07076419b7eb74a6f40fc8df93 100644 (file)
@@ -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.
  *