mm: don't warn about allocations which stall for too long
[GitHub/LineageOS/android_kernel_motorola_exynos9610.git] / mm / balloon_compaction.c
index 68d28924ba79d66cec76535f19772de6dc429522..ef858d547e2d7b69676aff410a52c32edc7986f0 100644 (file)
 #include <linux/export.h>
 #include <linux/balloon_compaction.h>
 
+/*
+ * balloon_page_alloc - allocates a new page for insertion into the balloon
+ *                       page list.
+ *
+ * Driver must call it to properly allocate a new enlisted balloon page.
+ * Driver must call balloon_page_enqueue before definitively removing it from
+ * the guest system.  This function returns the page address for the recently
+ * allocated page or NULL in the case we fail to allocate a new page this turn.
+ */
+struct page *balloon_page_alloc(void)
+{
+       struct page *page = alloc_page(balloon_mapping_gfp_mask() |
+                                      __GFP_NOMEMALLOC | __GFP_NORETRY);
+       return page;
+}
+EXPORT_SYMBOL_GPL(balloon_page_alloc);
+
 /*
  * balloon_page_enqueue - allocates a new page and inserts it into the balloon
  *                       page list.
  * @b_dev_info: balloon device descriptor where we will insert a new page to
+ * @page: new page to enqueue - allocated using balloon_page_alloc.
  *
- * Driver must call it to properly allocate a new enlisted balloon page
+ * Driver must call it to properly enqueue a new allocated balloon page
  * before definitively removing it from the guest system.
  * 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.
  */
-struct page *balloon_page_enqueue(struct balloon_dev_info *b_dev_info)
+void balloon_page_enqueue(struct balloon_dev_info *b_dev_info,
+                         struct page *page)
 {
        unsigned long flags;
-       struct page *page = alloc_page(balloon_mapping_gfp_mask() |
-                                      __GFP_NOMEMALLOC | __GFP_NORETRY);
-       if (!page)
-               return NULL;
 
        /*
         * Block others from accessing the 'page' when we get around to
@@ -39,7 +54,6 @@ struct page *balloon_page_enqueue(struct balloon_dev_info *b_dev_info)
        __count_vm_event(BALLOON_INFLATE);
        spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
        unlock_page(page);
-       return page;
 }
 EXPORT_SYMBOL_GPL(balloon_page_enqueue);