From: Michal Hocko <mhocko@kernel.org>
To: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Mel Gorman <mgorman@suse.de>,
David Rientjes <rientjes@google.com>,
Michal Hocko <mhocko@suse.com>
Subject: [PATCH 2/4] mm, page_alloc: warn_alloc print nodemask
Date: Thu, 12 Jan 2017 14:16:57 +0100 [thread overview]
Message-ID: <20170112131659.23058-3-mhocko@kernel.org> (raw)
In-Reply-To: <20170112131659.23058-1-mhocko@kernel.org>
From: Michal Hocko <mhocko@suse.com>
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.
Signed-off-by: Michal Hocko <mhocko@suse.com>
---
include/linux/mm.h | 4 ++--
mm/page_alloc.c | 9 +++++----
mm/vmalloc.c | 4 ++--
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 57dc3c3b53c1..3e35eb04a28a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1912,8 +1912,8 @@ extern void si_meminfo_node(struct sysinfo *val, int nid);
extern unsigned long arch_reserved_kernel_pages(void);
#endif
-extern __printf(2, 3)
-void warn_alloc(gfp_t gfp_mask, const char *fmt, ...);
+extern __printf(3, 4)
+void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...);
extern void setup_per_cpu_pageset(void);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 8f4f306d804c..0a9805a696bb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3031,12 +3031,13 @@ static void warn_alloc_show_mem(gfp_t gfp_mask)
show_mem(filter);
}
-void warn_alloc(gfp_t gfp_mask, const char *fmt, ...)
+void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...)
{
struct va_format vaf;
va_list args;
static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL,
DEFAULT_RATELIMIT_BURST);
+ nodemask_t *nm = (nodemask) ? nodemask : &cpuset_current_mems_allowed;
if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs) ||
debug_guardpage_minorder() > 0)
@@ -3050,7 +3051,7 @@ void warn_alloc(gfp_t gfp_mask, const char *fmt, ...)
pr_cont("%pV", &vaf);
va_end(args);
- pr_cont(", mode:%#x(%pGg)\n", gfp_mask, &gfp_mask);
+ pr_cont(", mode:%#x(%pGg), nodemask=%*pbl\n", gfp_mask, &gfp_mask, nodemask_pr_args(nm));
dump_stack();
warn_alloc_show_mem(gfp_mask);
@@ -3709,7 +3710,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
/* Make sure we know about allocations which stall for too long */
if (time_after(jiffies, alloc_start + stall_timeout)) {
- warn_alloc(gfp_mask,
+ warn_alloc(gfp_mask, ac->nodemask,
"page allocation stalls for %ums, order:%u",
jiffies_to_msecs(jiffies-alloc_start), order);
stall_timeout += 10 * HZ;
@@ -3743,7 +3744,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
}
nopage:
- warn_alloc(gfp_mask,
+ warn_alloc(gfp_mask, ac->nodemask,
"page allocation failure: order:%u", order);
got_pg:
return page;
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index b9999fc44aa6..0600bbbd1080 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1662,7 +1662,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
return area->addr;
fail:
- warn_alloc(gfp_mask,
+ warn_alloc(gfp_mask, NULL,
"vmalloc: allocation failure, allocated %ld of %ld bytes",
(area->nr_pages*PAGE_SIZE), area->size);
vfree(area->addr);
@@ -1724,7 +1724,7 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,
return addr;
fail:
- warn_alloc(gfp_mask,
+ warn_alloc(gfp_mask, NULL,
"vmalloc: allocation failure: %lu bytes", real_size);
return NULL;
}
--
2.11.0
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-01-12 13:17 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-12 13:16 [PATCH 0/4] show_mem updates Michal Hocko
2017-01-12 13:16 ` [PATCH 1/4] mm, page_alloc: do not report all nodes in show_mem Michal Hocko
2017-01-12 13:47 ` Mel Gorman
2017-01-14 16:26 ` Johannes Weiner
2017-01-12 13:16 ` Michal Hocko [this message]
2017-01-12 13:47 ` [PATCH 2/4] mm, page_alloc: warn_alloc print nodemask Mel Gorman
2017-01-13 11:31 ` Vlastimil Babka
2017-01-13 14:58 ` Michal Hocko
2017-01-12 13:16 ` [RFC PATCH 3/4] arch, mm: remove arch specific show_mem Michal Hocko
2017-01-12 13:48 ` Mel Gorman
2017-01-12 17:53 ` Chris Metcalf
2017-01-12 20:04 ` Helge Deller
2017-01-13 2:49 ` Xuetao Guan
2017-01-14 16:29 ` Johannes Weiner
2017-01-12 13:16 ` [PATCH 4/4] lib/show_mem.c: teach show_mem to work with the given nodemask Michal Hocko
2017-01-12 13:49 ` Mel Gorman
2017-01-13 13:08 ` Vlastimil Babka
2017-01-13 15:08 ` Michal Hocko
2017-01-13 15:30 ` Vlastimil Babka
2017-01-17 9:15 [PATCH 0/4 v2] show_mem updates Michal Hocko
2017-01-17 9:15 ` [PATCH 2/4] mm, page_alloc: warn_alloc print nodemask Michal Hocko
2017-01-17 9:32 ` Hillf Danton
2017-01-17 23:01 ` David Rientjes
2017-01-18 10:10 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170112131659.23058-3-mhocko@kernel.org \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.com \
--cc=rientjes@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox