aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mm/init.c3
-rw-r--r--arch/ia64/mm/contig.c68
-rw-r--r--arch/ia64/mm/discontig.c63
-rw-r--r--arch/ia64/mm/init.c48
-rw-r--r--arch/parisc/mm/init.c59
-rw-r--r--arch/unicore32/mm/init.c3
-rw-r--r--include/linux/mm.h1
-rw-r--r--lib/show_mem.c3
-rw-r--r--mm/page_alloc.c7
9 files changed, 65 insertions, 190 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 3e8f106ee5fe..2e71e245df90 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -92,9 +92,6 @@ void show_mem(unsigned int filter)
92 printk("Mem-info:\n"); 92 printk("Mem-info:\n");
93 show_free_areas(filter); 93 show_free_areas(filter);
94 94
95 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
96 return;
97
98 for_each_bank (i, mi) { 95 for_each_bank (i, mi) {
99 struct membank *bank = &mi->bank[i]; 96 struct membank *bank = &mi->bank[i];
100 unsigned int pfn1, pfn2; 97 unsigned int pfn1, pfn2;
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index da5237d636d6..52715a71aede 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -31,74 +31,6 @@
31static unsigned long max_gap; 31static unsigned long max_gap;
32#endif 32#endif
33 33
34/**
35 * show_mem - give short summary of memory stats
36 *
37 * Shows a simple page count of reserved and used pages in the system.
38 * For discontig machines, it does this on a per-pgdat basis.
39 */
40void show_mem(unsigned int filter)
41{
42 int i, total_reserved = 0;
43 int total_shared = 0, total_cached = 0;
44 unsigned long total_present = 0;
45 pg_data_t *pgdat;
46
47 printk(KERN_INFO "Mem-info:\n");
48 show_free_areas(filter);
49 printk(KERN_INFO "Node memory in pages:\n");
50 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
51 return;
52 for_each_online_pgdat(pgdat) {
53 unsigned long present;
54 unsigned long flags;
55 int shared = 0, cached = 0, reserved = 0;
56 int nid = pgdat->node_id;
57
58 if (skip_free_areas_node(filter, nid))
59 continue;
60 pgdat_resize_lock(pgdat, &flags);
61 present = pgdat->node_present_pages;
62 for(i = 0; i < pgdat->node_spanned_pages; i++) {
63 struct page *page;
64 if (unlikely(i % MAX_ORDER_NR_PAGES == 0))
65 touch_nmi_watchdog();
66 if (pfn_valid(pgdat->node_start_pfn + i))
67 page = pfn_to_page(pgdat->node_start_pfn + i);
68 else {
69#ifdef CONFIG_VIRTUAL_MEM_MAP
70 if (max_gap < LARGE_GAP)
71 continue;
72#endif
73 i = vmemmap_find_next_valid_pfn(nid, i) - 1;
74 continue;
75 }
76 if (PageReserved(page))
77 reserved++;
78 else if (PageSwapCache(page))
79 cached++;
80 else if (page_count(page))
81 shared += page_count(page)-1;
82 }
83 pgdat_resize_unlock(pgdat, &flags);
84 total_present += present;
85 total_reserved += reserved;
86 total_cached += cached;
87 total_shared += shared;
88 printk(KERN_INFO "Node %4d: RAM: %11ld, rsvd: %8d, "
89 "shrd: %10d, swpd: %10d\n", nid,
90 present, reserved, shared, cached);
91 }
92 printk(KERN_INFO "%ld pages of RAM\n", total_present);
93 printk(KERN_INFO "%d reserved pages\n", total_reserved);
94 printk(KERN_INFO "%d pages shared\n", total_shared);
95 printk(KERN_INFO "%d pages swap cached\n", total_cached);
96 printk(KERN_INFO "Total of %ld pages in page table cache\n",
97 quicklist_total_size());
98 printk(KERN_INFO "%ld free buffer pages\n", nr_free_buffer_pages());
99}
100
101
102/* physical address where the bootmem map is located */ 34/* physical address where the bootmem map is located */
103unsigned long bootmap_start; 35unsigned long bootmap_start;
104 36
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 2de08f4d9930..878626805369 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -608,69 +608,6 @@ void *per_cpu_init(void)
608#endif /* CONFIG_SMP */ 608#endif /* CONFIG_SMP */
609 609
610/** 610/**
611 * show_mem - give short summary of memory stats
612 *
613 * Shows a simple page count of reserved and used pages in the system.
614 * For discontig machines, it does this on a per-pgdat basis.
615 */
616void show_mem(unsigned int filter)
617{
618 int i, total_reserved = 0;
619 int total_shared = 0, total_cached = 0;
620 unsigned long total_present = 0;
621 pg_data_t *pgdat;
622
623 printk(KERN_INFO "Mem-info:\n");
624 show_free_areas(filter);
625 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
626 return;
627 printk(KERN_INFO "Node memory in pages:\n");
628 for_each_online_pgdat(pgdat) {
629 unsigned long present;
630 unsigned long flags;
631 int shared = 0, cached = 0, reserved = 0;
632 int nid = pgdat->node_id;
633
634 if (skip_free_areas_node(filter, nid))
635 continue;
636 pgdat_resize_lock(pgdat, &flags);
637 present = pgdat->node_present_pages;
638 for(i = 0; i < pgdat->node_spanned_pages; i++) {
639 struct page *page;
640 if (unlikely(i % MAX_ORDER_NR_PAGES == 0))
641 touch_nmi_watchdog();
642 if (pfn_valid(pgdat->node_start_pfn + i))
643 page = pfn_to_page(pgdat->node_start_pfn + i);
644 else {
645 i = vmemmap_find_next_valid_pfn(nid, i) - 1;
646 continue;
647 }
648 if (PageReserved(page))
649 reserved++;
650 else if (PageSwapCache(page))
651 cached++;
652 else if (page_count(page))
653 shared += page_count(page)-1;
654 }
655 pgdat_resize_unlock(pgdat, &flags);
656 total_present += present;
657 total_reserved += reserved;
658 total_cached += cached;
659 total_shared += shared;
660 printk(KERN_INFO "Node %4d: RAM: %11ld, rsvd: %8d, "
661 "shrd: %10d, swpd: %10d\n", nid,
662 present, reserved, shared, cached);
663 }
664 printk(KERN_INFO "%ld pages of RAM\n", total_present);
665 printk(KERN_INFO "%d reserved pages\n", total_reserved);
666 printk(KERN_INFO "%d pages shared\n", total_shared);
667 printk(KERN_INFO "%d pages swap cached\n", total_cached);
668 printk(KERN_INFO "Total of %ld pages in page table cache\n",
669 quicklist_total_size());
670 printk(KERN_INFO "%ld free buffer pages\n", nr_free_buffer_pages());
671}
672
673/**
674 * call_pernode_memory - use SRAT to call callback functions with node info 611 * call_pernode_memory - use SRAT to call callback functions with node info
675 * @start: physical start of range 612 * @start: physical start of range
676 * @len: length of range 613 * @len: length of range
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 88504abf5704..25c350264a41 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -684,3 +684,51 @@ per_linux32_init(void)
684} 684}
685 685
686__initcall(per_linux32_init); 686__initcall(per_linux32_init);
687
688/**
689 * show_mem - give short summary of memory stats
690 *
691 * Shows a simple page count of reserved and used pages in the system.
692 * For discontig machines, it does this on a per-pgdat basis.
693 */
694void show_mem(unsigned int filter)
695{
696 int total_reserved = 0;
697 unsigned long total_present = 0;
698 pg_data_t *pgdat;
699
700 printk(KERN_INFO "Mem-info:\n");
701 show_free_areas(filter);
702 printk(KERN_INFO "Node memory in pages:\n");
703 for_each_online_pgdat(pgdat) {
704 unsigned long present;
705 unsigned long flags;
706 int reserved = 0;
707 int nid = pgdat->node_id;
708 int zoneid;
709
710 if (skip_free_areas_node(filter, nid))
711 continue;
712 pgdat_resize_lock(pgdat, &flags);
713
714 for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
715 struct zone *zone = &pgdat->node_zones[zoneid];
716 if (!populated_zone(zone))
717 continue;
718
719 reserved += zone->present_pages - zone->managed_pages;
720 }
721 present = pgdat->node_present_pages;
722
723 pgdat_resize_unlock(pgdat, &flags);
724 total_present += present;
725 total_reserved += reserved;
726 printk(KERN_INFO "Node %4d: RAM: %11ld, rsvd: %8d, ",
727 nid, present, reserved);
728 }
729 printk(KERN_INFO "%ld pages of RAM\n", total_present);
730 printk(KERN_INFO "%d reserved pages\n", total_reserved);
731 printk(KERN_INFO "Total of %ld pages in page table cache\n",
732 quicklist_total_size());
733 printk(KERN_INFO "%ld free buffer pages\n", nr_free_buffer_pages());
734}
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 96f8168cf4ec..ae085ad0fba0 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -645,55 +645,30 @@ EXPORT_SYMBOL(empty_zero_page);
645 645
646void show_mem(unsigned int filter) 646void show_mem(unsigned int filter)
647{ 647{
648 int i,free = 0,total = 0,reserved = 0; 648 int total = 0,reserved = 0;
649 int shared = 0, cached = 0; 649 pg_data_t *pgdat;
650 650
651 printk(KERN_INFO "Mem-info:\n"); 651 printk(KERN_INFO "Mem-info:\n");
652 show_free_areas(filter); 652 show_free_areas(filter);
653 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
654 return;
655#ifndef CONFIG_DISCONTIGMEM
656 i = max_mapnr;
657 while (i-- > 0) {
658 total++;
659 if (PageReserved(mem_map+i))
660 reserved++;
661 else if (PageSwapCache(mem_map+i))
662 cached++;
663 else if (!page_count(&mem_map[i]))
664 free++;
665 else
666 shared += page_count(&mem_map[i]) - 1;
667 }
668#else
669 for (i = 0; i < npmem_ranges; i++) {
670 int j;
671 653
672 for (j = node_start_pfn(i); j < node_end_pfn(i); j++) { 654 for_each_online_pgdat(pgdat) {
673 struct page *p; 655 unsigned long flags;
674 unsigned long flags; 656 int zoneid;
675 657
676 pgdat_resize_lock(NODE_DATA(i), &flags); 658 pgdat_resize_lock(pgdat, &flags);
677 p = nid_page_nr(i, j) - node_start_pfn(i); 659 for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) {
678 660 struct zone *zone = &pgdat->node_zones[zoneid];
679 total++; 661 if (!populated_zone(zone))
680 if (PageReserved(p)) 662 continue;
681 reserved++; 663
682 else if (PageSwapCache(p)) 664 total += zone->present_pages;
683 cached++; 665 reserved = zone->present_pages - zone->managed_pages;
684 else if (!page_count(p)) 666 }
685 free++; 667 pgdat_resize_unlock(pgdat, &flags);
686 else
687 shared += page_count(p) - 1;
688 pgdat_resize_unlock(NODE_DATA(i), &flags);
689 }
690 } 668 }
691#endif 669
692 printk(KERN_INFO "%d pages of RAM\n", total); 670 printk(KERN_INFO "%d pages of RAM\n", total);
693 printk(KERN_INFO "%d reserved pages\n", reserved); 671 printk(KERN_INFO "%d reserved pages\n", reserved);
694 printk(KERN_INFO "%d pages shared\n", shared);
695 printk(KERN_INFO "%d pages swap cached\n", cached);
696
697 672
698#ifdef CONFIG_DISCONTIGMEM 673#ifdef CONFIG_DISCONTIGMEM
699 { 674 {
diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c
index ae6bc036db92..be2bde9b07cf 100644
--- a/arch/unicore32/mm/init.c
+++ b/arch/unicore32/mm/init.c
@@ -66,9 +66,6 @@ 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
72 for_each_bank(i, mi) { 69 for_each_bank(i, mi) {
73 struct membank *bank = &mi->bank[i]; 70 struct membank *bank = &mi->bank[i];
74 unsigned int pfn1, pfn2; 71 unsigned int pfn1, pfn2;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index fc4415256ec3..4c0c01afc19b 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1016,7 +1016,6 @@ extern void pagefault_out_of_memory(void);
1016 * various contexts. 1016 * various contexts.
1017 */ 1017 */
1018#define SHOW_MEM_FILTER_NODES (0x0001u) /* disallowed nodes */ 1018#define SHOW_MEM_FILTER_NODES (0x0001u) /* disallowed nodes */
1019#define SHOW_MEM_FILTER_PAGE_COUNT (0x0002u) /* page type count */
1020 1019
1021extern void show_free_areas(unsigned int flags); 1020extern void show_free_areas(unsigned int flags);
1022extern bool skip_free_areas_node(unsigned int flags, int nid); 1021extern bool skip_free_areas_node(unsigned int flags, int nid);
diff --git a/lib/show_mem.c b/lib/show_mem.c
index 5847a4921b8e..f58689f5a24e 100644
--- a/lib/show_mem.c
+++ b/lib/show_mem.c
@@ -17,9 +17,6 @@ void show_mem(unsigned int filter)
17 printk("Mem-Info:\n"); 17 printk("Mem-Info:\n");
18 show_free_areas(filter); 18 show_free_areas(filter);
19 19
20 if (filter & SHOW_MEM_FILTER_PAGE_COUNT)
21 return;
22
23 for_each_online_pgdat(pgdat) { 20 for_each_online_pgdat(pgdat) {
24 unsigned long flags; 21 unsigned long flags;
25 int zoneid; 22 int zoneid;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 89d81f4429ca..ec4417cb458a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2072,13 +2072,6 @@ void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...)
2072 return; 2072 return;
2073 2073
2074 /* 2074 /*
2075 * Walking all memory to count page types is very expensive and should
2076 * be inhibited in non-blockable contexts.
2077 */
2078 if (!(gfp_mask & __GFP_WAIT))
2079 filter |= SHOW_MEM_FILTER_PAGE_COUNT;
2080
2081 /*
2082 * This documents exceptions given to allocations in certain 2075 * This documents exceptions given to allocations in certain
2083 * contexts that are allowed to allocate outside current's set 2076 * contexts that are allowed to allocate outside current's set
2084 * of allowed nodes. 2077 * of allowed nodes.