summaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorMichal Hocko <mhocko@suse.com>2017-02-22 18:46:10 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-22 19:41:30 -0500
commita8e99259e7e32b67af2b447f0a570813c0c283ec (patch)
treef9dec7e486865ca687e78b1e49907f44c175718f /mm/page_alloc.c
parentc02e50bb8a55a7adeeca5e411479ed70c6a2dfa1 (diff)
mm, page_alloc: warn_alloc print nodemask
warn_alloc is currently used for to report an allocation failure or an allocation stall. We print some details of the allocation request like the gfp mask and the request order. We do not print the allocation nodemask which is important when debugging the reason for the allocation failure as well. We alreaddy print the nodemask in the OOM report. Add nodemask to warn_alloc and print it in warn_alloc as well. Link: http://lkml.kernel.org/r/20170117091543.25850-3-mhocko@kernel.org Signed-off-by: Michal Hocko <mhocko@suse.com> Acked-by: Mel Gorman <mgorman@suse.de> Acked-by: Hillf Danton <hillf.zj@alibaba-inc.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index cf6b53dc08f9..96c8fe602dfb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3028,12 +3028,13 @@ static void warn_alloc_show_mem(gfp_t gfp_mask)
3028 show_mem(filter); 3028 show_mem(filter);
3029} 3029}
3030 3030
3031void warn_alloc(gfp_t gfp_mask, const char *fmt, ...) 3031void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...)
3032{ 3032{
3033 struct va_format vaf; 3033 struct va_format vaf;
3034 va_list args; 3034 va_list args;
3035 static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL, 3035 static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL,
3036 DEFAULT_RATELIMIT_BURST); 3036 DEFAULT_RATELIMIT_BURST);
3037 nodemask_t *nm = (nodemask) ? nodemask : &cpuset_current_mems_allowed;
3037 3038
3038 if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs) || 3039 if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs) ||
3039 debug_guardpage_minorder() > 0) 3040 debug_guardpage_minorder() > 0)
@@ -3047,7 +3048,8 @@ void warn_alloc(gfp_t gfp_mask, const char *fmt, ...)
3047 pr_cont("%pV", &vaf); 3048 pr_cont("%pV", &vaf);
3048 va_end(args); 3049 va_end(args);
3049 3050
3050 pr_cont(", mode:%#x(%pGg)\n", gfp_mask, &gfp_mask); 3051 pr_cont(", mode:%#x(%pGg), nodemask=%*pbl\n", gfp_mask, &gfp_mask, nodemask_pr_args(nm));
3052 cpuset_print_current_mems_allowed();
3051 3053
3052 dump_stack(); 3054 dump_stack();
3053 warn_alloc_show_mem(gfp_mask); 3055 warn_alloc_show_mem(gfp_mask);
@@ -3724,7 +3726,7 @@ retry:
3724 3726
3725 /* Make sure we know about allocations which stall for too long */ 3727 /* Make sure we know about allocations which stall for too long */
3726 if (time_after(jiffies, alloc_start + stall_timeout)) { 3728 if (time_after(jiffies, alloc_start + stall_timeout)) {
3727 warn_alloc(gfp_mask, 3729 warn_alloc(gfp_mask, ac->nodemask,
3728 "page allocation stalls for %ums, order:%u", 3730 "page allocation stalls for %ums, order:%u",
3729 jiffies_to_msecs(jiffies-alloc_start), order); 3731 jiffies_to_msecs(jiffies-alloc_start), order);
3730 stall_timeout += 10 * HZ; 3732 stall_timeout += 10 * HZ;
@@ -3775,7 +3777,7 @@ nopage:
3775 if (read_mems_allowed_retry(cpuset_mems_cookie)) 3777 if (read_mems_allowed_retry(cpuset_mems_cookie))
3776 goto retry_cpuset; 3778 goto retry_cpuset;
3777 3779
3778 warn_alloc(gfp_mask, 3780 warn_alloc(gfp_mask, ac->nodemask,
3779 "page allocation failure: order:%u", order); 3781 "page allocation failure: order:%u", order);
3780got_pg: 3782got_pg:
3781 return page; 3783 return page;