Merge branch 'akpm' (patches from Andrew)
[cascardo/linux.git] / mm / page_alloc.c
index 5ab2e30..ca423cc 100644 (file)
@@ -3493,6 +3493,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
        enum compact_result compact_result;
        int compaction_retries = 0;
        int no_progress_loops = 0;
+       unsigned long alloc_start = jiffies;
+       unsigned int stall_timeout = 10 * HZ;
 
        /*
         * In the slowpath, we sanity check order to avoid ever trying to
@@ -3648,6 +3650,14 @@ retry:
        if (order > PAGE_ALLOC_COSTLY_ORDER && !(gfp_mask & __GFP_REPEAT))
                goto nopage;
 
+       /* Make sure we know about allocations which stall for too long */
+       if (time_after(jiffies, alloc_start + stall_timeout)) {
+               warn_alloc(gfp_mask,
+                       "page alloction stalls for %ums, order:%u\n",
+                       jiffies_to_msecs(jiffies-alloc_start), order);
+               stall_timeout += 10 * HZ;
+       }
+
        if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags,
                                 did_some_progress > 0, &no_progress_loops))
                goto retry;