lib, arch: add filter argument to show_mem and fix private implementations

Commit ddd588b5dd55 ("oom: suppress nodes that are not allowed from
meminfo on oom kill") moved lib/show_mem.o out of lib/lib.a, which
resulted in build warnings on all architectures that implement their own
versions of show_mem():

lib/lib.a(show_mem.o): In function `show_mem':
show_mem.c:(.text+0x1f4): multiple definition of `show_mem'
arch/sparc/mm/built-in.o:(.text+0xd70): first defined here

The fix is to remove __show_mem() and add its argument to show_mem() in
all implementations to prevent this breakage.

Architectures that implement their own show_mem() actually don't do
anything with the argument yet, but they could be made to filter nodes
that aren't allowed in the current context in the future just like the
generic implementation.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reported-by: James Bottomley <James.Bottomley@hansenpartnership.com>
Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by David Rientjes and committed by Linus Torvalds b2b755b5 e285c174

+15 -21
+1 -1
arch/arm/mm/init.c
··· 78 78 */ 79 79 struct meminfo meminfo; 80 80 81 - void show_mem(void) 81 + void show_mem(unsigned int filter) 82 82 { 83 83 int free = 0, total = 0, reserved = 0; 84 84 int shared = 0, cached = 0, slab = 0, i;
+1 -1
arch/ia64/mm/contig.c
··· 36 36 * Shows a simple page count of reserved and used pages in the system. 37 37 * For discontig machines, it does this on a per-pgdat basis. 38 38 */ 39 - void show_mem(void) 39 + void show_mem(unsigned int filter) 40 40 { 41 41 int i, total_reserved = 0; 42 42 int total_shared = 0, total_cached = 0;
+1 -1
arch/ia64/mm/discontig.c
··· 614 614 * Shows a simple page count of reserved and used pages in the system. 615 615 * For discontig machines, it does this on a per-pgdat basis. 616 616 */ 617 - void show_mem(void) 617 + void show_mem(unsigned int filter) 618 618 { 619 619 int i, total_reserved = 0; 620 620 int total_shared = 0, total_cached = 0;
+1 -1
arch/parisc/mm/init.c
··· 544 544 unsigned long *empty_zero_page __read_mostly; 545 545 EXPORT_SYMBOL(empty_zero_page); 546 546 547 - void show_mem(void) 547 + void show_mem(unsigned int filter) 548 548 { 549 549 int i,free = 0,total = 0,reserved = 0; 550 550 int shared = 0, cached = 0;
+1 -1
arch/powerpc/xmon/xmon.c
··· 821 821 memzcan(); 822 822 break; 823 823 case 'i': 824 - show_mem(); 824 + show_mem(0); 825 825 break; 826 826 default: 827 827 termch = cmd;
+1 -1
arch/sparc/mm/init_32.c
··· 75 75 kmap_prot = __pgprot(SRMMU_ET_PTE | SRMMU_PRIV | SRMMU_CACHE); 76 76 } 77 77 78 - void show_mem(void) 78 + void show_mem(unsigned int filter) 79 79 { 80 80 printk("Mem-info:\n"); 81 81 show_free_areas();
+1 -1
arch/tile/mm/pgtable.c
··· 41 41 * The normal show_free_areas() is too verbose on Tile, with dozens 42 42 * of processors and often four NUMA zones each with high and lowmem. 43 43 */ 44 - void show_mem(void) 44 + void show_mem(unsigned int filter) 45 45 { 46 46 struct zone *zone; 47 47
+1 -1
arch/unicore32/mm/init.c
··· 55 55 */ 56 56 struct meminfo meminfo; 57 57 58 - void show_mem(void) 58 + void show_mem(unsigned int filter) 59 59 { 60 60 int free = 0, total = 0, reserved = 0; 61 61 int shared = 0, cached = 0, slab = 0, i;
+1 -1
drivers/tty/sysrq.c
··· 306 306 307 307 static void sysrq_handle_showmem(int key) 308 308 { 309 - show_mem(); 309 + show_mem(0); 310 310 } 311 311 static struct sysrq_key_op sysrq_showmem_op = { 312 312 .handler = sysrq_handle_showmem,
+1 -1
drivers/tty/vt/keyboard.c
··· 600 600 601 601 static void fn_show_mem(struct vc_data *vc) 602 602 { 603 - show_mem(); 603 + show_mem(0); 604 604 } 605 605 606 606 static void fn_show_state(struct vc_data *vc)
+2 -3
include/linux/mm.h
··· 861 861 #define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) 862 862 863 863 /* 864 - * Flags passed to __show_mem() and __show_free_areas() to suppress output in 864 + * Flags passed to show_mem() and __show_free_areas() to suppress output in 865 865 * various contexts. 866 866 */ 867 867 #define SHOW_MEM_FILTER_NODES (0x0001u) /* filter disallowed nodes */ ··· 1360 1360 extern void calculate_zone_inactive_ratio(struct zone *zone); 1361 1361 extern void mem_init(void); 1362 1362 extern void __init mmap_init(void); 1363 - extern void show_mem(void); 1364 - extern void __show_mem(unsigned int flags); 1363 + extern void show_mem(unsigned int flags); 1365 1364 extern void si_meminfo(struct sysinfo * val); 1366 1365 extern void si_meminfo_node(struct sysinfo *val, int nid); 1367 1366 extern int after_bootmem;
+1 -6
lib/show_mem.c
··· 9 9 #include <linux/nmi.h> 10 10 #include <linux/quicklist.h> 11 11 12 - void __show_mem(unsigned int filter) 12 + void show_mem(unsigned int filter) 13 13 { 14 14 pg_data_t *pgdat; 15 15 unsigned long total = 0, reserved = 0, shared = 0, ··· 60 60 printk("%lu pages in pagetable cache\n", 61 61 quicklist_total_size()); 62 62 #endif 63 - } 64 - 65 - void show_mem(void) 66 - { 67 - __show_mem(0); 68 63 }
+1 -1
mm/oom_kill.c
··· 406 406 task_unlock(current); 407 407 dump_stack(); 408 408 mem_cgroup_print_oom_info(mem, p); 409 - __show_mem(SHOW_MEM_FILTER_NODES); 409 + show_mem(SHOW_MEM_FILTER_NODES); 410 410 if (sysctl_oom_dump_tasks) 411 411 dump_tasks(mem, nodemask); 412 412 }
+1 -1
mm/page_alloc.c
··· 2195 2195 current->comm, order, gfp_mask); 2196 2196 dump_stack(); 2197 2197 if (!should_suppress_show_mem()) 2198 - __show_mem(filter); 2198 + show_mem(filter); 2199 2199 } 2200 2200 return page; 2201 2201 got_pg: