From: David Rientjes Date: Tue, 22 Mar 2011 23:30:47 +0000 (-0700) Subject: oom: suppress show_mem() for many nodes in irq context on page alloc failure X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=29423e77c06cee7d4e335ef4a7cbd949da978c91;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git oom: suppress show_mem() for many nodes in irq context on page alloc failure When a page allocation failure occurs, show_mem() is called to dump the state of the VM so users may understand what happened to get into that condition. This output, however, can be extremely verbose. In irq context, it may result in significant delays that incur NMI watchdog timeouts when the machine is large (we use CONFIG_NODES_SHIFT > 8 here to define a "large" machine since the length of the show_mem() output is proportional to the number of possible nodes). This patch suppresses the show_mem() call in irq context when the kernel has CONFIG_NODES_SHIFT > 8. Signed-off-by: David Rientjes Cc: Mel Gorman Cc: KAMEZAWA Hiroyuki Cc: KOSAKI Motohiro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 36be3ba4bbe..2aaafe82f51 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1714,6 +1714,20 @@ try_next_zone: return page; } +/* + * Large machines with many possible nodes should not always dump per-node + * meminfo in irq context. + */ +static inline bool should_suppress_show_mem(void) +{ + bool ret = false; + +#if NODES_SHIFT > 8 + ret = in_interrupt(); +#endif + return ret; +} + static inline int should_alloc_retry(gfp_t gfp_mask, unsigned int order, unsigned long pages_reclaimed) @@ -2161,7 +2175,8 @@ nopage: " order:%d, mode:0x%x\n", current->comm, order, gfp_mask); dump_stack(); - show_mem(); + if (!should_suppress_show_mem()) + show_mem(); } return page; got_pg: