]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm, page_alloc: warn_alloc print nodemask
authorMichal Hocko <mhocko@suse.com>
Wed, 22 Feb 2017 23:46:10 +0000 (15:46 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Feb 2017 00:41:30 +0000 (16:41 -0800)
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>
include/linux/mm.h
mm/page_alloc.c
mm/vmalloc.c

index dae6f58d67c81e1d71d2bb7ce5162b9d67fa0a65..28b6c3f8a7f3846f20105e6303d6c9219a514e1b 100644 (file)
@@ -1942,8 +1942,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);
 
index cf6b53dc08f9fdcbd11be7908d40371ecd504c13..96c8fe602dfbe1ee8394969d59c1c560b26284bb 100644 (file)
@@ -3028,12 +3028,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)
@@ -3047,7 +3048,8 @@ 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));
+       cpuset_print_current_mems_allowed();
 
        dump_stack();
        warn_alloc_show_mem(gfp_mask);
@@ -3724,7 +3726,7 @@ retry:
 
        /* 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;
@@ -3775,7 +3777,7 @@ nopage:
        if (read_mems_allowed_retry(cpuset_mems_cookie))
                goto retry_cpuset;
 
-       warn_alloc(gfp_mask,
+       warn_alloc(gfp_mask, ac->nodemask,
                        "page allocation failure: order:%u", order);
 got_pg:
        return page;
index 5f5b09e9dccdffa8445b25e6772fc0905492b0f5..d89034a393f276457118b0696613c92c83ae8fcc 100644 (file)
@@ -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;
 }