]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - mm/page_alloc.c
UBUNTU: [Config] CONFIG_NET_DSA_LOOP=m
[mirror_ubuntu-artful-kernel.git] / mm / page_alloc.c
index 1bad301820c7a2e2729fc2f7c04e4b3694131576..6ce930c02160d55dc4eee1e7197a5efa6ba7d44a 100644 (file)
@@ -66,6 +66,7 @@
 #include <linux/kthread.h>
 #include <linux/memcontrol.h>
 #include <linux/ftrace.h>
+#include <linux/nmi.h>
 
 #include <asm/sections.h>
 #include <asm/tlbflush.h>
@@ -2535,9 +2536,14 @@ void drain_all_pages(struct zone *zone)
 
 #ifdef CONFIG_HIBERNATION
 
+/*
+ * Touch the watchdog for every WD_PAGE_COUNT pages.
+ */
+#define WD_PAGE_COUNT  (128*1024)
+
 void mark_free_pages(struct zone *zone)
 {
-       unsigned long pfn, max_zone_pfn;
+       unsigned long pfn, max_zone_pfn, page_count = WD_PAGE_COUNT;
        unsigned long flags;
        unsigned int order, t;
        struct page *page;
@@ -2552,6 +2558,11 @@ void mark_free_pages(struct zone *zone)
                if (pfn_valid(pfn)) {
                        page = pfn_to_page(pfn);
 
+                       if (!--page_count) {
+                               touch_nmi_watchdog();
+                               page_count = WD_PAGE_COUNT;
+                       }
+
                        if (page_zone(page) != zone)
                                continue;
 
@@ -2565,8 +2576,13 @@ void mark_free_pages(struct zone *zone)
                        unsigned long i;
 
                        pfn = page_to_pfn(page);
-                       for (i = 0; i < (1UL << order); i++)
+                       for (i = 0; i < (1UL << order); i++) {
+                               if (!--page_count) {
+                                       touch_nmi_watchdog();
+                                       page_count = WD_PAGE_COUNT;
+                               }
                                swsusp_set_page_free(pfn_to_page(pfn + i));
+                       }
                }
        }
        spin_unlock_irqrestore(&zone->lock, flags);
@@ -3275,10 +3291,13 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
        /*
         * Go through the zonelist yet one more time, keep very high watermark
         * here, this is only to catch a parallel oom killing, we must fail if
-        * we're still under heavy pressure.
+        * we're still under heavy pressure. But make sure that this reclaim
+        * attempt shall not depend on __GFP_DIRECT_RECLAIM && !__GFP_NORETRY
+        * allocation which will never fail due to oom_lock already held.
         */
-       page = get_page_from_freelist(gfp_mask | __GFP_HARDWALL, order,
-                                       ALLOC_WMARK_HIGH|ALLOC_CPUSET, ac);
+       page = get_page_from_freelist((gfp_mask | __GFP_HARDWALL) &
+                                     ~__GFP_DIRECT_RECLAIM, order,
+                                     ALLOC_WMARK_HIGH|ALLOC_CPUSET, ac);
        if (page)
                goto out;
 
@@ -7673,8 +7692,6 @@ int alloc_contig_range(unsigned long start, unsigned long end,
 
        /* Make sure the range is really isolated. */
        if (test_pages_isolated(outer_start, end, false)) {
-               pr_info_ratelimited("%s: [%lx, %lx) PFNs busy\n",
-                       __func__, outer_start, end);
                ret = -EBUSY;
                goto done;
        }