diff options
-rw-r--r-- | arch/arm/mm/init.c | 3 | ||||
-rw-r--r-- | arch/ia64/mm/contig.c | 2 | ||||
-rw-r--r-- | arch/ia64/mm/discontig.c | 2 | ||||
-rw-r--r-- | arch/parisc/mm/init.c | 2 | ||||
-rw-r--r-- | arch/unicore32/mm/init.c | 3 | ||||
-rw-r--r-- | include/linux/mm.h | 3 | ||||
-rw-r--r-- | lib/show_mem.c | 3 | ||||
-rw-r--r-- | mm/page_alloc.c | 7 |
8 files changed, 24 insertions, 1 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index ad722f1208a5..ad9a9f3f0322 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -99,6 +99,9 @@ void show_mem(unsigned int filter) | |||
99 | printk("Mem-info:\n"); | 99 | printk("Mem-info:\n"); |
100 | show_free_areas(filter); | 100 | show_free_areas(filter); |
101 | 101 | ||
102 | if (filter & SHOW_MEM_FILTER_PAGE_COUNT) | ||
103 | return; | ||
104 | |||
102 | for_each_bank (i, mi) { | 105 | for_each_bank (i, mi) { |
103 | struct membank *bank = &mi->bank[i]; | 106 | struct membank *bank = &mi->bank[i]; |
104 | unsigned int pfn1, pfn2; | 107 | unsigned int pfn1, pfn2; |
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c index 80dab509dfb0..67c59ebec899 100644 --- a/arch/ia64/mm/contig.c +++ b/arch/ia64/mm/contig.c | |||
@@ -47,6 +47,8 @@ void show_mem(unsigned int filter) | |||
47 | printk(KERN_INFO "Mem-info:\n"); | 47 | printk(KERN_INFO "Mem-info:\n"); |
48 | show_free_areas(filter); | 48 | show_free_areas(filter); |
49 | printk(KERN_INFO "Node memory in pages:\n"); | 49 | printk(KERN_INFO "Node memory in pages:\n"); |
50 | if (filter & SHOW_MEM_FILTER_PAGE_COUNT) | ||
51 | return; | ||
50 | for_each_online_pgdat(pgdat) { | 52 | for_each_online_pgdat(pgdat) { |
51 | unsigned long present; | 53 | unsigned long present; |
52 | unsigned long flags; | 54 | unsigned long flags; |
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c index c2e955ee79a8..a57436e5d405 100644 --- a/arch/ia64/mm/discontig.c +++ b/arch/ia64/mm/discontig.c | |||
@@ -623,6 +623,8 @@ void show_mem(unsigned int filter) | |||
623 | 623 | ||
624 | printk(KERN_INFO "Mem-info:\n"); | 624 | printk(KERN_INFO "Mem-info:\n"); |
625 | show_free_areas(filter); | 625 | show_free_areas(filter); |
626 | if (filter & SHOW_MEM_FILTER_PAGE_COUNT) | ||
627 | return; | ||
626 | printk(KERN_INFO "Node memory in pages:\n"); | 628 | printk(KERN_INFO "Node memory in pages:\n"); |
627 | for_each_online_pgdat(pgdat) { | 629 | for_each_online_pgdat(pgdat) { |
628 | unsigned long present; | 630 | unsigned long present; |
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index 3ac462de53a4..cf2da13c41e6 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c | |||
@@ -697,6 +697,8 @@ void show_mem(unsigned int filter) | |||
697 | 697 | ||
698 | printk(KERN_INFO "Mem-info:\n"); | 698 | printk(KERN_INFO "Mem-info:\n"); |
699 | show_free_areas(filter); | 699 | show_free_areas(filter); |
700 | if (filter & SHOW_MEM_FILTER_PAGE_COUNT) | ||
701 | return; | ||
700 | #ifndef CONFIG_DISCONTIGMEM | 702 | #ifndef CONFIG_DISCONTIGMEM |
701 | i = max_mapnr; | 703 | i = max_mapnr; |
702 | while (i-- > 0) { | 704 | while (i-- > 0) { |
diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c index de186bde8975..644482882bae 100644 --- a/arch/unicore32/mm/init.c +++ b/arch/unicore32/mm/init.c | |||
@@ -66,6 +66,9 @@ void show_mem(unsigned int filter) | |||
66 | printk(KERN_DEFAULT "Mem-info:\n"); | 66 | printk(KERN_DEFAULT "Mem-info:\n"); |
67 | show_free_areas(filter); | 67 | show_free_areas(filter); |
68 | 68 | ||
69 | if (filter & SHOW_MEM_FILTER_PAGE_COUNT) | ||
70 | return; | ||
71 | |||
69 | for_each_bank(i, mi) { | 72 | for_each_bank(i, mi) { |
70 | struct membank *bank = &mi->bank[i]; | 73 | struct membank *bank = &mi->bank[i]; |
71 | unsigned int pfn1, pfn2; | 74 | unsigned int pfn1, pfn2; |
diff --git a/include/linux/mm.h b/include/linux/mm.h index e2091b88d24c..f3c7b1f9d1d8 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -899,7 +899,8 @@ extern void pagefault_out_of_memory(void); | |||
899 | * Flags passed to show_mem() and show_free_areas() to suppress output in | 899 | * Flags passed to show_mem() and show_free_areas() to suppress output in |
900 | * various contexts. | 900 | * various contexts. |
901 | */ | 901 | */ |
902 | #define SHOW_MEM_FILTER_NODES (0x0001u) /* filter disallowed nodes */ | 902 | #define SHOW_MEM_FILTER_NODES (0x0001u) /* disallowed nodes */ |
903 | #define SHOW_MEM_FILTER_PAGE_COUNT (0x0002u) /* page type count */ | ||
903 | 904 | ||
904 | extern void show_free_areas(unsigned int flags); | 905 | extern void show_free_areas(unsigned int flags); |
905 | extern bool skip_free_areas_node(unsigned int flags, int nid); | 906 | extern bool skip_free_areas_node(unsigned int flags, int nid); |
diff --git a/lib/show_mem.c b/lib/show_mem.c index 4407f8c9b1f7..b7c72311ad0c 100644 --- a/lib/show_mem.c +++ b/lib/show_mem.c | |||
@@ -18,6 +18,9 @@ void show_mem(unsigned int filter) | |||
18 | printk("Mem-Info:\n"); | 18 | printk("Mem-Info:\n"); |
19 | show_free_areas(filter); | 19 | show_free_areas(filter); |
20 | 20 | ||
21 | if (filter & SHOW_MEM_FILTER_PAGE_COUNT) | ||
22 | return; | ||
23 | |||
21 | for_each_online_pgdat(pgdat) { | 24 | for_each_online_pgdat(pgdat) { |
22 | unsigned long i, flags; | 25 | unsigned long i, flags; |
23 | 26 | ||
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 7ff1536f01b8..da7a2fe7332e 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2003,6 +2003,13 @@ void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...) | |||
2003 | return; | 2003 | return; |
2004 | 2004 | ||
2005 | /* | 2005 | /* |
2006 | * Walking all memory to count page types is very expensive and should | ||
2007 | * be inhibited in non-blockable contexts. | ||
2008 | */ | ||
2009 | if (!(gfp_mask & __GFP_WAIT)) | ||
2010 | filter |= SHOW_MEM_FILTER_PAGE_COUNT; | ||
2011 | |||
2012 | /* | ||
2006 | * This documents exceptions given to allocations in certain | 2013 | * This documents exceptions given to allocations in certain |
2007 | * contexts that are allowed to allocate outside current's set | 2014 | * contexts that are allowed to allocate outside current's set |
2008 | * of allowed nodes. | 2015 | * of allowed nodes. |