aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorMichal Hocko <mhocko@suse.com>2016-10-07 20:01:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-07 21:46:29 -0400
commit63f53dea0c9866e93802d50a230c460a024c44e5 (patch)
tree8045e5150c6f016b9fd5040e10f57d4c9394a4a9 /mm
parent7877cdcc3893c1bd9a833b2f0398e7320794c6e6 (diff)
mm: warn about allocations which stall for too long
Currently we do warn only about allocation failures but small allocations are basically nofail and they might loop in the page allocator for a long time. Especially when the reclaim cannot make any progress - e.g. GFP_NOFS cannot invoke the oom killer and rely on a different context to make a forward progress in case there is a lot memory used by filesystems. Give us at least a clue when something like this happens and warn about allocations which take more than 10s. Print the basic allocation context information along with the cumulative time spent in the allocation as well as the allocation stack. Repeat the warning after every 10 seconds so that we know that the problem is permanent rather than ephemeral. Link: http://lkml.kernel.org/r/20160929084407.7004-3-mhocko@kernel.org Signed-off-by: Michal Hocko <mhocko@suse.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Mel Gorman <mgorman@suse.de> Cc: Dave Hansen <dave.hansen@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/page_alloc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5ab2e30a1006..ca423cc20b59 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3493,6 +3493,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
3493 enum compact_result compact_result; 3493 enum compact_result compact_result;
3494 int compaction_retries = 0; 3494 int compaction_retries = 0;
3495 int no_progress_loops = 0; 3495 int no_progress_loops = 0;
3496 unsigned long alloc_start = jiffies;
3497 unsigned int stall_timeout = 10 * HZ;
3496 3498
3497 /* 3499 /*
3498 * In the slowpath, we sanity check order to avoid ever trying to 3500 * In the slowpath, we sanity check order to avoid ever trying to
@@ -3648,6 +3650,14 @@ retry:
3648 if (order > PAGE_ALLOC_COSTLY_ORDER && !(gfp_mask & __GFP_REPEAT)) 3650 if (order > PAGE_ALLOC_COSTLY_ORDER && !(gfp_mask & __GFP_REPEAT))
3649 goto nopage; 3651 goto nopage;
3650 3652
3653 /* Make sure we know about allocations which stall for too long */
3654 if (time_after(jiffies, alloc_start + stall_timeout)) {
3655 warn_alloc(gfp_mask,
3656 "page alloction stalls for %ums, order:%u\n",
3657 jiffies_to_msecs(jiffies-alloc_start), order);
3658 stall_timeout += 10 * HZ;
3659 }
3660
3651 if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags, 3661 if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags,
3652 did_some_progress > 0, &no_progress_loops)) 3662 did_some_progress > 0, &no_progress_loops))
3653 goto retry; 3663 goto retry;