mm: generic show_mem() v4
Subsystems (16)
cover mm: generic show_mem() v4
Every arch implements its own show_mem() function. Most of them share quite some code, some of them are completely identical.
This series implements a generic version of this function and migrates almost all architectures to it.
version 4:
- rebased against -mmotm
- remove free swap space display from alpha, m32r, sh, sparc64, um (was in a different series originally, but -mm no longer has them and Linus' tree does not contain them too)
version 3:
- Fix kbuild logic as suggested by Sam Ravnborg
version 2:
- Fix kbuild bits as suggested by Heiko Carstens
- Include quicklist info as suggested by Paul Mundt
- Extend changelogs by info on removal of redundant output
arch/alpha/Kconfig | 1 + arch/alpha/mm/init.c | 30 ------------------------ arch/alpha/mm/numa.c | 35 ---------------------------- arch/avr32/Kconfig | 1 + arch/avr32/mm/init.c | 39 ------------------------------- arch/blackfin/Kconfig | 1 + arch/blackfin/mm/init.c | 27 ---------------------- arch/cris/Kconfig | 1 + arch/cris/mm/init.c | 30 ------------------------ arch/frv/Kconfig | 1 + arch/frv/mm/init.c | 31 ------------------------- arch/h8300/Kconfig | 1 + arch/h8300/mm/init.c | 27 ---------------------- arch/m32r/Kconfig | 1 + arch/m32r/mm/init.c | 36 ----------------------------- arch/m68k/Kconfig | 1 + arch/m68k/mm/init.c | 30 ------------------------ arch/m68knommu/Kconfig | 1 + arch/m68knommu/mm/init.c | 27 ---------------------- arch/mips/Kconfig | 1 + arch/mips/mm/Makefile | 3 +- arch/mips/mm/pgtable.c | 36 ----------------------------- arch/mn10300/Kconfig | 1 + arch/mn10300/mm/pgtable.c | 27 ---------------------- arch/powerpc/Kconfig | 1 + arch/powerpc/mm/mem.c | 39 ------------------------------- arch/s390/Kconfig | 1 + arch/s390/mm/init.c | 32 -------------------------- arch/sh/Kconfig | 1 + arch/sh/mm/init.c | 41 --------------------------------- arch/sparc64/Kconfig | 1 + arch/sparc64/mm/init.c | 45 ------------------------------------ arch/um/Kconfig | 1 + arch/um/kernel/mem.c | 31 ------------------------- arch/x86/Kconfig | 1 + arch/x86/mm/init_64.c | 37 ------------------------------ arch/x86/mm/pgtable_32.c | 47 -------------------------------------- arch/xtensa/Kconfig | 1 + arch/xtensa/mm/init.c | 26 --------------------- mm/Kconfig | 3 ++ mm/page_alloc.c | 55 +++++++++++++++++++++++++++++++++++++++++++++ mm/swap_state.c | 3 +- 42 files changed, 79 insertions(+), 676 deletions(-)
PATCH 1/20 mm: print swapcache page count in show_swap_cache_info()
Most show_mem() implementations calculate the amount of pages within the swapcache every time. Move the output to a more appropriate place and use the anyway available total_swapcache_pages variable.
--- mm/swap_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/swap_state.c +2 -1
@@ -56,7 +56,8 @@ static struct {void show_swap_cache_info (void ) { -printk ("Swap cache: add %lu, delete %lu, find %lu/%lu\n" , +printk ("%lu pages in swap cache\n" , total_swapcache_pages); +printk ("Swap cache stats: add %lu, delete %lu, find %lu/%lu\n" , swap_cache_info.add_total, swap_cache_info.del_total, swap_cache_info.find_success, swap_cache_info.find_total);printk ("Free swap = %lukB\n" , nr_swap_pages << (PAGE_SHIFT -10 ));
PATCH 2/20 mm: generic show_mem()
In reply to Johannes WeinerThis implements a platform-independent version of show_mem().
--- mm/Kconfig | 3 +++ mm/page_alloc.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+)
mm/page_alloc.c +55 -0
@@ -45,6 +45,7 @@#include <linux/fault-inject.h> #include <linux/page-isolation.h> #include <linux/memcontrol.h> +#include <linux/nmi.h> #include <linux/debugobjects.h> #include <asm/tlbflush.h>
@@ -2042,6 +2043,60 @@ static void zoneref_set_zone(struct zone zoneref->zone_idx =zone_idx (zone); } +#ifdef CONFIG_HAVE_GENERIC_SHOW_MEM +void show_mem (void ) +{ +pg_data_t *pgdat; +int total =0 , reserved =0 , shared =0 , nonshared =0 , highmem =0 ; + +printk (KERN_INFO "Mem-Info:\n" ); +show_free_areas (); + +for_each_online_pgdat (pgdat) { +unsigned long i, flags; + +pgdat_resize_lock (pgdat, &flags); +for (i =0 ; i < pgdat->node_spanned_pages; i++) { +struct page *page; +unsigned long pfn = pgdat->node_start_pfn + i; + +if (unlikely ((i %MAX_ORDER_NR_PAGES ) ==0 )) +touch_nmi_watchdog (); + +if (!pfn_valid (pfn)) +continue ; + + page =pfn_to_page (pfn); + +if (PageHighMem (page)) + highmem++; + +if (PageReserved (page)) + reserved++; +else if (page_count (page) ==1 ) + nonshared++; +else if (page_count (page) >1 ) + shared +=page_count (page) -1 ; + + total++; + } +pgdat_resize_unlock (pgdat, &flags); + } + +printk (KERN_INFO "%d pages RAM\n" , total); +#ifdef CONFIG_HIGHMEM +printk (KERN_INFO "%d pages HighMem\n" , highmem); +#endif +printk (KERN_INFO "%d pages reserved\n" , reserved); +printk (KERN_INFO "%d pages shared\n" , shared); +printk (KERN_INFO "%d pages non-shared\n" , nonshared); +#ifdef CONFIG_QUICKLIST +printk (KERN_INFO "%d pages in pagetable cache\n" , +quicklist_total_size ()); +#endif +} +#endif /* CONFIG_HAVE_GENERIC_SHOW_MEM */ +/* * Builds allocation fallback zone lists. *
mm/Kconfig +3 -0
@@ -213,6 +213,9 @@ config VIRT_TO_BUS config PAGE_WALKER def_bool n +config HAVE_GENERIC_SHOW_MEM + def_bool n + config UNEVICTABLE_LRU bool "Add LRU list to track non-evictable pages" default y
PATCH 3/20 alpha: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- free pages, printed by show_free_areas()
- free swap pages, printed by show_swap_cache_info()
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/alpha/Kconfig | 1 + arch/alpha/mm/init.c | 30 ------------------------------ arch/alpha/mm/numa.c | 35 ----------------------------------- 3 files changed, 1 insertion(+), 65 deletions(-)
arch/alpha/Kconfig +1 -0
@@ -7,6 +7,7 @@ config ALPHA default y select HAVE_IDE select HAVE_OPROFILE + select HAVE_GENERIC_SHOW_MEM help The Alpha is a 64-bit general-purpose processor designed and marketed by the Digital Equipment Corporation of blessed memory,
arch/alpha/mm/init.c +0 -30
@@ -94,36 +94,6 @@ __bad_page(void)return pte_mkdirty (mk_pte (virt_to_page (EMPTY_PGE ),PAGE_SHARED )); } -#ifndef CONFIG_DISCONTIGMEM -void -show_mem (void ) -{ -long i,free =0 ,total =0 ,reserved =0 ; -long shared =0 , cached =0 ; - -printk ("\nMem-info:\n" ); -show_free_areas (); -printk ("Free swap: %6ldkB\n" , nr_swap_pages<<(PAGE_SHIFT -10 )); - i = max_mapnr; -while (i-- >0 ) { - total++; -if (PageReserved (mem_map+i)) - reserved++; -else if (PageSwapCache (mem_map+i)) - cached++; -else if (!page_count (mem_map+i)) - free++; -else - shared +=page_count (mem_map + i) -1 ; - } -printk ("%ld pages of RAM\n" ,total); -printk ("%ld free pages\n" ,free); -printk ("%ld reserved pages\n" ,reserved); -printk ("%ld pages shared\n" ,shared); -printk ("%ld pages swap cached\n" ,cached); -} -#endif -static inline unsigned long load_PCB (struct pcb_struct *pcb) {
arch/alpha/mm/numa.c +0 -35
@@ -359,38 +359,3 @@ void __init mem_init(void)mem_stress ();#endif } - -void -show_mem (void ) -{ -long i,free =0 ,total =0 ,reserved =0 ; -long shared =0 , cached =0 ; -int nid; - -printk ("\nMem-info:\n" ); -show_free_areas (); -printk ("Free swap: %6ldkB\n" , nr_swap_pages<<(PAGE_SHIFT -10 )); -for_each_online_node (nid) { -unsigned long flags; -pgdat_resize_lock (NODE_DATA (nid), &flags); - i =node_spanned_pages (nid); -while (i-- >0 ) { -struct page *page =nid_page_nr (nid, i); - total++; -if (PageReserved (page)) - reserved++; -else if (PageSwapCache (page)) - cached++; -else if (!page_count (page)) - free++; -else - shared +=page_count (page) -1 ; - } -pgdat_resize_unlock (NODE_DATA (nid), &flags); - } -printk ("%ld pages of RAM\n" ,total); -printk ("%ld free pages\n" ,free); -printk ("%ld reserved pages\n" ,reserved); -printk ("%ld pages shared\n" ,shared); -printk ("%ld pages swap cached\n" ,cached); -}
PATCH 4/20 avr32: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- free pages, printed by show_free_areas()
- pages in slabs, printed by show_free_areas()
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/avr32/Kconfig | 1 + arch/avr32/mm/init.c | 39 --------------------------------------- 2 files changed, 1 insertion(+), 39 deletions(-)
arch/avr32/mm/init.c +0 -39
@@ -36,45 +36,6 @@ EXPORT_SYMBOL(empty_zero_page);*/ unsigned long mmu_context_cache =NO_CONTEXT ; -void show_mem (void ) -{ -int total =0 , reserved =0 , cached =0 ; -int slab =0 , free =0 , shared =0 ; -pg_data_t *pgdat; - -printk ("Mem-info:\n" ); -show_free_areas (); - -for_each_online_pgdat (pgdat) { -struct page *page, *end; - - page = pgdat->node_mem_map; - end = page + pgdat->node_spanned_pages; - -do { - total++; -if (PageReserved (page)) - reserved++; -else if (PageSwapCache (page)) - cached++; -else if (PageSlab (page)) - slab++; -else if (!page_count (page)) - free++; -else - shared +=page_count (page) -1 ; - page++; - }while (page < end); - } - -printk ("%d pages of RAM\n" , total); -printk ("%d free pages\n" , free); -printk ("%d reserved pages\n" , reserved); -printk ("%d slab pages\n" , slab); -printk ("%d pages shared\n" , shared); -printk ("%d pages swap cached\n" , cached); -} -/* * paging_init() sets up the page tables *
arch/avr32/Kconfig +1 -0
@@ -13,6 +13,7 @@ config AVR32 select HAVE_CLK select HAVE_OPROFILE select HAVE_KPROBES + select HAVE_GENERIC_SHOW_MEM help AVR32 is a high-performance 32-bit RISC microprocessor core, designed for cost-sensitive embedded applications, with particular
PATCH 5/20 blackfin: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- free pages, printed by show_free_areas()
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/blackfin/Kconfig | 1 + arch/blackfin/mm/init.c | 27 --------------------------- 2 files changed, 1 insertion(+), 27 deletions(-)
arch/blackfin/mm/init.c +0 -27
@@ -53,33 +53,6 @@ static unsigned long empty_bad_page;unsigned long empty_zero_page; -void show_mem (void ) -{ -unsigned long i; -int free =0 , total =0 , reserved =0 , shared =0 ; - -int cached =0 ; -printk (KERN_INFO "Mem-info:\n" ); -show_free_areas (); - i = max_mapnr; -while (i-- >0 ) { - total++; -if (PageReserved (mem_map + i)) - reserved++; -else if (PageSwapCache (mem_map + i)) - cached++; -else if (!page_count (mem_map + i)) - free++; -else - shared +=page_count (mem_map + i) -1 ; - } -printk (KERN_INFO "%d pages of RAM\n" , total); -printk (KERN_INFO "%d free pages\n" , free); -printk (KERN_INFO "%d reserved pages\n" , reserved); -printk (KERN_INFO "%d pages shared\n" , shared); -printk (KERN_INFO "%d pages swap cached\n" , cached); -} -/* * paging_init() continues the virtual memory environment setup which * was begun by the code in arch/head.S.
arch/blackfin/Kconfig +1 -0
@@ -26,6 +26,7 @@ config BLACKFIN default y select HAVE_IDE select HAVE_OPROFILE + select HAVE_GENERIC_SHOW_MEM config ZONE_DMA bool
PATCH 6/20 cris: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- free pages, printed by show_free_areas()
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/cris/Kconfig | 1 + arch/cris/mm/init.c | 30 ------------------------------ 2 files changed, 1 insertion(+), 30 deletions(-)
arch/cris/Kconfig +1 -0
@@ -55,6 +55,7 @@ config CRIS bool default y select HAVE_IDE + select HAVE_GENERIC_SHOW_MEM config HZ int
arch/cris/mm/init.c +0 -30
@@ -19,36 +19,6 @@ unsigned long empty_zero_page;extern char _stext, _edata, _etext;/* From linkerscript */ extern char __init_begin, __init_end; -void -show_mem (void ) -{ -int i,free =0 ,total =0 ,cached =0 , reserved =0 , nonshared =0 ; -int shared =0 ; - -printk ("\nMem-info:\n" ); -show_free_areas (); - i = max_mapnr; -while (i-- >0 ) { - total++; -if (PageReserved (mem_map+i)) - reserved++; -else if (PageSwapCache (mem_map+i)) - cached++; -else if (!page_count (mem_map+i)) - free++; -else if (page_count (mem_map+i) ==1 ) - nonshared++; -else - shared +=page_count (mem_map+i) -1 ; - } -printk ("%d pages of RAM\n" ,total); -printk ("%d free pages\n" ,free); -printk ("%d reserved pages\n" ,reserved); -printk ("%d pages nonshared\n" ,nonshared); -printk ("%d pages shared\n" ,shared); -printk ("%d pages swap cached\n" ,cached); -} -void __init mem_init (void ) {
PATCH 7/20 frv: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- free pages, printed by show_free_areas()
where show_mem() calls show_free_areas().
--- arch/frv/Kconfig | 1 + arch/frv/mm/init.c | 31 ------------------------------- 2 files changed, 1 insertion(+), 31 deletions(-)
arch/frv/Kconfig +1 -0
@@ -6,6 +6,7 @@ config FRV bool default y select HAVE_IDE + select HAVE_GENERIC_SHOW_MEM config ZONE_DMA bool
arch/frv/mm/init.c +0 -31
@@ -63,37 +63,6 @@ EXPORT_SYMBOL(empty_zero_page);/*****************************************************************************/ /* -* -*/ -void show_mem (void ) -{ -unsigned long i; -int free =0 , total =0 , reserved =0 , shared =0 ; - -printk ("\nMem-info:\n" ); -show_free_areas (); - i = max_mapnr; -while (i-- >0 ) { -struct page *page = &mem_map[i]; - - total++; -if (PageReserved (page)) - reserved++; -else if (!page_count (page)) - free++; -else - shared +=page_count (page) -1 ; - } - -printk ("%d pages of RAM\n" ,total); -printk ("%d free pages\n" ,free); -printk ("%d reserved pages\n" ,reserved); -printk ("%d pages shared\n" ,shared); - -}/* end show_mem() */ - -/*****************************************************************************/ -/* * paging_init() continues the virtual memory environment setup which * was begun by the code in arch/head.S. * The parameters are pointers to where to stick the starting and ending
PATCH 8/20 m32r: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- free swap pages, printed by show_swap_cache_info()
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/m32r/Kconfig | 1 + arch/m32r/mm/init.c | 36 ------------------------------------ 2 files changed, 1 insertion(+), 36 deletions(-)
arch/m32r/Kconfig +1 -0
@@ -10,6 +10,7 @@ config M32R default y select HAVE_IDE select HAVE_OPROFILE + select HAVE_GENERIC_SHOW_MEM config SBUS bool
arch/m32r/mm/init.c +0 -36
@@ -36,42 +36,6 @@ pgd_t swapper_pg_dir[1024]; DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); -void show_mem (void ) -{ -int total =0 , reserved =0 ; -int shared =0 , cached =0 ; -int highmem =0 ; -struct page *page; -pg_data_t *pgdat; -unsigned long i; - -printk ("Mem-info:\n" ); -show_free_areas (); -printk ("Free swap: %6ldkB\n" ,nr_swap_pages<<(PAGE_SHIFT -10 )); -for_each_online_pgdat (pgdat) { -unsigned long flags; -pgdat_resize_lock (pgdat, &flags); -for (i =0 ; i < pgdat->node_spanned_pages; ++i) { - page =pgdat_page_nr (pgdat, i); - total++; -if (PageHighMem (page)) - highmem++; -if (PageReserved (page)) - reserved++; -else if (PageSwapCache (page)) - cached++; -else if (page_count (page)) - shared +=page_count (page) -1 ; - } -pgdat_resize_unlock (pgdat, &flags); - } -printk ("%d pages of RAM\n" , total); -printk ("%d pages of HIGHMEM\n" ,highmem); -printk ("%d reserved pages\n" ,reserved); -printk ("%d pages shared\n" ,shared); -printk ("%d pages swap cached\n" ,cached); -} -/* * Cache of MMU context last used. */
PATCH 9/20 m68k: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- free pages, printed by show_free_areas()
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/m68k/Kconfig | 1 + arch/m68k/mm/init.c | 30 ------------------------------ 2 files changed, 1 insertion(+), 30 deletions(-)
arch/m68k/Kconfig +1 -0
@@ -6,6 +6,7 @@ config M68K bool default y select HAVE_IDE + select HAVE_GENERIC_SHOW_MEM config MMU bool
arch/m68k/mm/init.c +0 -30
@@ -69,36 +69,6 @@ void __init m68k_setup_node(int node)void *empty_zero_page;EXPORT_SYMBOL (empty_zero_page); -void show_mem (void ) -{ -pg_data_t *pgdat; -int free =0 , total =0 , reserved =0 , shared =0 ; -int cached =0 ; -int i; - -printk ("\nMem-info:\n" ); -show_free_areas (); -for_each_online_pgdat (pgdat) { -for (i =0 ; i < pgdat->node_spanned_pages; i++) { -struct page *page = pgdat->node_mem_map + i; - total++; -if (PageReserved (page)) - reserved++; -else if (PageSwapCache (page)) - cached++; -else if (!page_count (page)) - free++; -else - shared +=page_count (page) -1 ; - } - } -printk ("%d pages of RAM\n" ,total); -printk ("%d free pages\n" ,free); -printk ("%d reserved pages\n" ,reserved); -printk ("%d pages shared\n" ,shared); -printk ("%d pages swap cached\n" ,cached); -} -extern void init_pointer_table (unsigned long ptable);/* References to section boundaries */
PATCH 10/20 m68knommu: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- free pages, printed by show_free_areas()
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/m68knommu/Kconfig | 1 + arch/m68knommu/mm/init.c | 27 --------------------------- 2 files changed, 1 insertion(+), 27 deletions(-)
arch/m68knommu/Kconfig +1 -0
@@ -9,6 +9,7 @@ config M68K bool default y select HAVE_IDE + select HAVE_GENERIC_SHOW_MEM config MMU bool
arch/m68knommu/mm/init.c +0 -27
@@ -62,33 +62,6 @@ static unsigned long empty_bad_page;unsigned long empty_zero_page; -void show_mem (void ) -{ -unsigned long i; -int free =0 , total =0 , reserved =0 , shared =0 ; -int cached =0 ; - -printk (KERN_INFO "\nMem-info:\n" ); -show_free_areas (); - i = max_mapnr; -while (i-- >0 ) { - total++; -if (PageReserved (mem_map+i)) - reserved++; -else if (PageSwapCache (mem_map+i)) - cached++; -else if (!page_count (mem_map+i)) - free++; -else - shared +=page_count (mem_map+i) -1 ; - } -printk (KERN_INFO "%d pages of RAM\n" ,total); -printk (KERN_INFO "%d free pages\n" ,free); -printk (KERN_INFO "%d reserved pages\n" ,reserved); -printk (KERN_INFO "%d pages shared\n" ,shared); -printk (KERN_INFO "%d pages swap cached\n" ,cached); -} -extern unsigned long memory_start;extern unsigned long memory_end;
PATCH 11/20 mips: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
And show_mem() does now actually print something on configurations with multiple nodes.
--- arch/mips/Kconfig | 1 + arch/mips/mm/Makefile | 3 +-- arch/mips/mm/pgtable.c | 36 ------------------------------------ 3 files changed, 2 insertions(+), 38 deletions(-)
arch/mips/Kconfig +1 -0
@@ -3,6 +3,7 @@ config MIPS default y select HAVE_IDE select HAVE_OPROFILE + select HAVE_GENERIC_SHOW_MEM # Horrible source of confusion. Die, die, die ... select EMBEDDED select RTC_LIB
arch/mips/mm/Makefile +1 -2
@@ -3,8 +3,7 @@ # obj-y += cache.o dma-default.o extable.o fault.o \ - init.o pgtable.o tlbex.o tlbex-fault.o \ - uasm.o page.o + init.o tlbex.o tlbex-fault.o uasm.o page.o obj-$(CONFIG_32BIT) += ioremap.o pgtable-32.o obj-$(CONFIG_64BIT) += pgtable-64.o
arch/mips/mm/pgtable.c deleted +0 -36
@@ -1,36 +0,0 @@ -#include <linux/kernel.h> -#include <linux/mm.h> -#include <linux/swap.h> - -void show_mem (void ) -{ -#ifndef CONFIG_NEED_MULTIPLE_NODES /* XXX(hch): later.. */ -int pfn, total =0 , reserved =0 ; -int shared =0 , cached =0 ; -int highmem =0 ; -struct page *page; - -printk ("Mem-info:\n" ); -show_free_areas (); - pfn = max_mapnr; -while (pfn-- >0 ) { -if (!pfn_valid (pfn)) -continue ; - page =pfn_to_page (pfn); - total++; -if (PageHighMem (page)) - highmem++; -if (PageReserved (page)) - reserved++; -else if (PageSwapCache (page)) - cached++; -else if (page_count (page)) - shared +=page_count (page) -1 ; - } -printk ("%d pages of RAM\n" , total); -printk ("%d pages of HIGHMEM\n" , highmem); -printk ("%d reserved pages\n" , reserved); -printk ("%d pages shared\n" , shared); -printk ("%d pages swap cached\n" , cached); -#endif -}
PATCH 12/20 h8300: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- free pages, printed by show_free_areas()
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/h8300/Kconfig | 1 + arch/h8300/mm/init.c | 27 --------------------------- 2 files changed, 1 insertion(+), 27 deletions(-)
arch/h8300/Kconfig +1 -0
@@ -9,6 +9,7 @@ config H8300 bool default y select HAVE_IDE + select HAVE_GENERIC_SHOW_MEM config MMU bool
arch/h8300/mm/init.c +0 -27
@@ -64,33 +64,6 @@ unsigned long empty_zero_page;extern unsigned long rom_length; -void show_mem (void ) -{ -unsigned long i; -int free =0 , total =0 , reserved =0 , shared =0 ; -int cached =0 ; - -printk ("\nMem-info:\n" ); -show_free_areas (); - i = max_mapnr; -while (i-- >0 ) { - total++; -if (PageReserved (mem_map+i)) - reserved++; -else if (PageSwapCache (mem_map+i)) - cached++; -else if (!page_count (mem_map+i)) - free++; -else - shared +=page_count (mem_map+i) -1 ; - } -printk ("%d pages of RAM\n" ,total); -printk ("%d free pages\n" ,free); -printk ("%d reserved pages\n" ,reserved); -printk ("%d pages shared\n" ,shared); -printk ("%d pages swap cached\n" ,cached); -} -extern unsigned long memory_start;extern unsigned long memory_end;
PATCH 13/20 mn10300: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- free pages, printed by show_free_areas()
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/mn10300/Kconfig | 1 + arch/mn10300/mm/pgtable.c | 27 --------------------------- 2 files changed, 1 insertion(+), 27 deletions(-)
arch/mn10300/Kconfig +1 -0
@@ -7,6 +7,7 @@ mainmenu "Linux Kernel Configuration" config MN10300 def_bool y + select HAVE_GENERIC_SHOW_MEM config AM33 def_bool y
arch/mn10300/mm/pgtable.c +0 -27
@@ -27,33 +27,6 @@#include <asm/tlb.h> #include <asm/tlbflush.h> -void show_mem (void ) -{ -unsigned long i; -int free =0 , total =0 , reserved =0 , shared =0 ; - -int cached =0 ; -printk (KERN_INFO "Mem-info:\n" ); -show_free_areas (); - i = max_mapnr; -while (i-- >0 ) { - total++; -if (PageReserved (mem_map + i)) - reserved++; -else if (PageSwapCache (mem_map + i)) - cached++; -else if (!page_count (mem_map + i)) - free++; -else - shared +=page_count (mem_map + i) -1 ; - } -printk (KERN_INFO "%d pages of RAM\n" , total); -printk (KERN_INFO "%d free pages\n" , free); -printk (KERN_INFO "%d reserved pages\n" , reserved); -printk (KERN_INFO "%d pages shared\n" , shared); -printk (KERN_INFO "%d pages swap cached\n" , cached); -} -/* * Associate a large virtual page frame with a given physical page frame * and protection flags for that frame. pfn is for the base of the page,
PATCH 14/20 powerpc: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/powerpc/Kconfig | 1 + arch/powerpc/mm/mem.c | 39 --------------------------------------- 2 files changed, 1 insertion(+), 39 deletions(-)
arch/powerpc/Kconfig +1 -0
@@ -114,6 +114,7 @@ config PPC select HAVE_KRETPROBES select HAVE_LMB select HAVE_OPROFILE + select HAVE_GENERIC_SHOW_MEM select USE_GENERIC_SMP_HELPERS if SMP config EARLY_PRINTK
arch/powerpc/mm/mem.c +0 -39
@@ -185,45 +185,6 @@ walk_memory_resource(unsigned long start }EXPORT_SYMBOL_GPL (walk_memory_resource); -void show_mem (void ) -{ -unsigned long total =0 , reserved =0 ; -unsigned long shared =0 , cached =0 ; -unsigned long highmem =0 ; -struct page *page; -pg_data_t *pgdat; -unsigned long i; - -printk ("Mem-info:\n" ); -show_free_areas (); -for_each_online_pgdat (pgdat) { -unsigned long flags; -pgdat_resize_lock (pgdat, &flags); -for (i =0 ; i < pgdat->node_spanned_pages; i++) { -if (!pfn_valid (pgdat->node_start_pfn + i)) -continue ; - page =pgdat_page_nr (pgdat, i); - total++; -if (PageHighMem (page)) - highmem++; -if (PageReserved (page)) - reserved++; -else if (PageSwapCache (page)) - cached++; -else if (page_count (page)) - shared +=page_count (page) -1 ; - } -pgdat_resize_unlock (pgdat, &flags); - } -printk ("%ld pages of RAM\n" , total); -#ifdef CONFIG_HIGHMEM -printk ("%ld pages of HIGHMEM\n" , highmem); -#endif -printk ("%ld reserved pages\n" , reserved); -printk ("%ld pages shared\n" , shared); -printk ("%ld pages swap cached\n" , cached); -} -/* * Initialize the bootmem system and give it all the memory we * have available. If we are using highmem, we only put the
PATCH 15/20 s390: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/s390/Kconfig | 1 + arch/s390/mm/init.c | 32 -------------------------------- 2 files changed, 1 insertion(+), 32 deletions(-)
arch/s390/Kconfig +1 -0
@@ -73,6 +73,7 @@ config S390 select HAVE_OPROFILE select HAVE_KPROBES select HAVE_KRETPROBES + select HAVE_GENERIC_SHOW_MEM select HAVE_KVM if 64BIT source "init/Kconfig"
arch/s390/mm/init.c +0 -32
@@ -42,38 +42,6 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_ga pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE))); char empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE))); -void show_mem (void ) -{ -unsigned long i, total =0 , reserved =0 ; -unsigned long shared =0 , cached =0 ; -unsigned long flags; -struct page *page; -pg_data_t *pgdat; - -printk ("Mem-info:\n" ); -show_free_areas (); -for_each_online_pgdat (pgdat) { -pgdat_resize_lock (pgdat, &flags); -for (i =0 ; i < pgdat->node_spanned_pages; i++) { -if (!pfn_valid (pgdat->node_start_pfn + i)) -continue ; - page =pfn_to_page (pgdat->node_start_pfn + i); - total++; -if (PageReserved (page)) - reserved++; -else if (PageSwapCache (page)) - cached++; -else if (page_count (page)) - shared +=page_count (page) -1 ; - } -pgdat_resize_unlock (pgdat, &flags); - } -printk ("%ld pages of RAM\n" , total); -printk ("%ld reserved pages\n" , reserved); -printk ("%ld pages shared\n" , shared); -printk ("%ld pages swap cached\n" , cached); -} -/* * paging_init() sets up the page tables */
PATCH 16/20 sh: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- free pages, printed by show_free_areas()
- pages in slab, printed by show_free_areas()
- free swap pages, printed by show_swap_cache_info()
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/sh/Kconfig | 1 + arch/sh/mm/init.c | 41 ----------------------------------------- 2 files changed, 1 insertion(+), 41 deletions(-)
arch/sh/Kconfig +1 -0
@@ -11,6 +11,7 @@ config SUPERH select HAVE_CLK select HAVE_IDE select HAVE_OPROFILE + select HAVE_GENERIC_SHOW_MEM help The SuperH is a RISC processor targeted for use in embedded systems and consumer electronics; it was also used in the Sega Dreamcast
arch/sh/mm/init.c +0 -41
47 lines not on this page · raw message
PATCH 17/20 sparc64: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- free swap pages, printed by show_swap_cache_info()
- pages in swapcache, printed by show_swap_cache_info()
- dirty pages, writeback pages, mapped pages, slab pages, pagetables pages, printed by show_free_areas()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/sparc64/Kconfig | 1 + arch/sparc64/mm/init.c | 45 --------------------------------------------- 2 files changed, 1 insertion(+), 45 deletions(-)
arch/sparc64/Kconfig +1 -0
@@ -7,6 +7,7 @@ config SPARC select HAVE_OPROFILE select HAVE_KPROBES select HAVE_KRETPROBES + select HAVE_GENERIC_SHOW_MEM config SPARC64 bool
arch/sparc64/mm/init.c +0 -45
51 lines not on this page · raw message
PATCH 18/20 um: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- free swap pages, printed by show_swap_cache_info()
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/um/Kconfig | 1 + arch/um/kernel/mem.c | 31 ------------------------------- 2 files changed, 1 insertion(+), 31 deletions(-)
arch/um/Kconfig +1 -0
@@ -11,6 +11,7 @@ config GENERIC_HARDIRQS config UML bool default y + select HAVE_GENERIC_SHOW_MEM config MMU bool
arch/um/kernel/mem.c +0 -31
@@ -264,37 +264,6 @@ void free_initrd_mem(unsigned long start }#endif -void show_mem (void ) -{ -int pfn, total =0 , reserved =0 ; -int shared =0 , cached =0 ; -int high_mem =0 ; -struct page *page; - -printk (KERN_INFO "Mem-info:\n" ); -show_free_areas (); -printk (KERN_INFO "Free swap: %6ldkB\n" , - nr_swap_pages<<(PAGE_SHIFT -10 )); - pfn = max_mapnr; -while (pfn-- >0 ) { - page =pfn_to_page (pfn); - total++; -if (PageHighMem (page)) - high_mem++; -if (PageReserved (page)) - reserved++; -else if (PageSwapCache (page)) - cached++; -else if (page_count (page)) - shared +=page_count (page) -1 ; - } -printk (KERN_INFO "%d pages of RAM\n" , total); -printk (KERN_INFO "%d pages of HIGHMEM\n" , high_mem); -printk (KERN_INFO "%d reserved pages\n" , reserved); -printk (KERN_INFO "%d pages shared\n" , shared); -printk (KERN_INFO "%d pages swap cached\n" , cached); -} -/* Allocate and free page tables. */ pgd_t *pgd_alloc (struct mm_struct *mm)
PATCH 19/20 x86: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- pages in swapcache, printed by show_swap_cache_info()
- dirty pages, writeback pages, mapped pages, slab pages, pagetable pages, printed by show_free_areas()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/x86/Kconfig | 1 + arch/x86/mm/init_64.c | 37 ------------------------------------- arch/x86/mm/pgtable_32.c | 47 ----------------------------------------------- 3 files changed, 1 insertion(+), 84 deletions(-)
arch/x86/mm/pgtable_32.c +0 -47
@@ -20,53 +20,6 @@#include <asm/tlb.h> #include <asm/tlbflush.h> -void show_mem (void ) -{ -int total =0 , reserved =0 ; -int shared =0 , cached =0 ; -int highmem =0 ; -struct page *page; -pg_data_t *pgdat; -unsigned long i; -unsigned long flags; - -printk (KERN_INFO "Mem-info:\n" ); -show_free_areas (); -for_each_online_pgdat (pgdat) { -pgdat_resize_lock (pgdat, &flags); -for (i =0 ; i < pgdat->node_spanned_pages; ++i) { -if (unlikely (i %MAX_ORDER_NR_PAGES ==0 )) -touch_nmi_watchdog (); - page =pgdat_page_nr (pgdat, i); - total++; -if (PageHighMem (page)) - highmem++; -if (PageReserved (page)) - reserved++; -else if (PageSwapCache (page)) - cached++; -else if (page_count (page)) - shared +=page_count (page) -1 ; - } -pgdat_resize_unlock (pgdat, &flags); - } -printk (KERN_INFO "%d pages of RAM\n" , total); -printk (KERN_INFO "%d pages of HIGHMEM\n" , highmem); -printk (KERN_INFO "%d reserved pages\n" , reserved); -printk (KERN_INFO "%d pages shared\n" , shared); -printk (KERN_INFO "%d pages swap cached\n" , cached); - -printk (KERN_INFO "%lu pages dirty\n" ,global_page_state (NR_FILE_DIRTY )); -printk (KERN_INFO "%lu pages writeback\n" , -global_page_state (NR_WRITEBACK )); -printk (KERN_INFO "%lu pages mapped\n" ,global_page_state (NR_FILE_MAPPED )); -printk (KERN_INFO "%lu pages slab\n" , -global_page_state (NR_SLAB_RECLAIMABLE ) + -global_page_state (NR_SLAB_UNRECLAIMABLE )); -printk (KERN_INFO "%lu pages pagetables\n" , -global_page_state (NR_PAGETABLE )); -} -/* * Associate a virtual page frame with a given physical page frame * and protection flags for that frame.
arch/x86/mm/init_64.c +0 -37
@@ -78,43 +78,6 @@ early_param("gbpages", parse_direct_gbpa* around without checking the pgd every time. */ -void show_mem (void ) -{ -long i, total =0 , reserved =0 ; -long shared =0 , cached =0 ; -struct page *page; -pg_data_t *pgdat; - -printk (KERN_INFO "Mem-info:\n" ); -show_free_areas (); -for_each_online_pgdat (pgdat) { -for (i =0 ; i < pgdat->node_spanned_pages; ++i) { -/* -* This loop can take a while with 256 GB and -* 4k pages so defer the NMI watchdog: -*/ -if (unlikely (i %MAX_ORDER_NR_PAGES ==0 )) -touch_nmi_watchdog (); - -if (!pfn_valid (pgdat->node_start_pfn + i)) -continue ; - - page =pfn_to_page (pgdat->node_start_pfn + i); - total++; -if (PageReserved (page)) - reserved++; -else if (PageSwapCache (page)) - cached++; -else if (page_count (page)) - shared +=page_count (page) -1 ; - } - } -printk (KERN_INFO "%lu pages of RAM\n" , total); -printk (KERN_INFO "%lu reserved pages\n" , reserved); -printk (KERN_INFO "%lu pages shared\n" , shared); -printk (KERN_INFO "%lu pages swap cached\n" , cached); -} -int after_bootmem;static __init void *spp_getpage (void )
arch/x86/Kconfig +1 -0
@@ -28,6 +28,7 @@ config X86 select HAVE_DYNAMIC_FTRACE select HAVE_FTRACE select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) + select HAVE_GENERIC_SHOW_MEM select HAVE_ARCH_KGDB if !X86_VOYAGER select HAVE_EFFICIENT_UNALIGNED_ACCESS
PATCH 20/20 xtensa: use generic show_mem()
In reply to Johannes WeinerRemove arch-specific show_mem() in favor of the generic version.
This also removes the following redundant information display:
- free pages, printed by show_free_areas()
- pages in swapcache, printed by show_swap_cache_info()
where show_mem() calls show_free_areas(), which calls show_swap_cache_info().
--- arch/xtensa/Kconfig | 1 + arch/xtensa/mm/init.c | 26 -------------------------- 2 files changed, 1 insertion(+), 26 deletions(-)
arch/xtensa/Kconfig +1 -0
@@ -15,6 +15,7 @@ config XTENSA bool default y select HAVE_IDE + select HAVE_GENERIC_SHOW_MEM help Xtensa processors are 32-bit RISC machines designed by Tensilica primarily for embedded systems. These processors are both
arch/xtensa/mm/init.c +0 -26
@@ -272,32 +272,6 @@ void free_initmem(void) (&__init_end - &__init_begin) >> 10); } -void show_mem (void ) -{ -int i, free =0 , total =0 , reserved =0 ; -int shared =0 , cached =0 ; - -printk ("Mem-info:\n" ); -show_free_areas (); - i = max_mapnr; -while (i-- >0 ) { - total++; -if (PageReserved (mem_map+i)) - reserved++; -else if (PageSwapCache (mem_map+i)) - cached++; -else if (!page_count (mem_map + i)) - free++; -else - shared +=page_count (mem_map + i) -1 ; - } -printk ("%d pages of RAM\n" , total); -printk ("%d reserved pages\n" , reserved); -printk ("%d pages shared\n" , shared); -printk ("%d pages swap cached\n" ,cached); -printk ("%d free pages\n" , free); -} -struct kmem_cache *pgtable_cache__read_mostly ;static void pgd_ctor (struct kmem_cache *cache,void * addr)
Re: [PATCH 02/20] mm: generic show_mem()
In reply to Johannes Weinermm/page_alloc.c static void zoneref_set_zone(struct zone · line 2050
Quoted 5 lines
mm/page_alloc.c +5
-0+#ifdef CONFIG_HAVE_GENERIC_SHOW_MEM +void show_mem (void ) +{ +pg_data_t *pgdat; +int total =0 , reserved =0 , shared =0 , nonshared =0 , highmem =0 ;
All of these should be unsigned long. Might overflow on very large configurations otherwise.
Re: [PATCH 18/20] um: use generic show_mem()
In reply to Johannes WeinerQuoted 1 line · Johannes Weiner
Remove arch-specific
show_mem()in favor of the generic version.
Still looks good for UML.
Jeff
Signature · 1 line
Work email - jdike at linux dot intel dot com
PATCH 2/20 mm: generic show_mem()
In reply to Heiko CarstensThis implements a platform-independent version of show_mem().
--- mm/Kconfig | 3 +++ mm/page_alloc.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+)
Quoted 8 lines · Heiko Carstens
Review
Quoted 5 lines
(quoted diff) +5
-0+#ifdef CONFIG_HAVE_GENERIC_SHOW_MEM +void show_mem(void) +{ + pg_data_t *pgdat; + int total = 0, reserved = 0, shared = 0, nonshared = 0, highmem = 0;All of these should be unsigned long. Might overflow on very large configurations otherwise.
Thanks Heiko for pointing it out. quicklist_total_size() also returns UL so I fixed up the format character there as well.
mm/page_alloc.c +56 -0
@@ -45,6 +45,7 @@#include <linux/fault-inject.h> #include <linux/page-isolation.h> #include <linux/memcontrol.h> +#include <linux/nmi.h> #include <linux/debugobjects.h> #include <asm/tlbflush.h>
@@ -2042,6 +2043,61 @@ static void zoneref_set_zone(struct zone zoneref->zone_idx =zone_idx (zone); } +#ifdef CONFIG_HAVE_GENERIC_SHOW_MEM +void show_mem (void ) +{ +pg_data_t *pgdat; +unsigned long total =0 , reserved =0 , shared =0 , + nonshared =0 , highmem =0 ; + +printk (KERN_INFO "Mem-Info:\n" ); +show_free_areas (); + +for_each_online_pgdat (pgdat) { +unsigned long i, flags; + +pgdat_resize_lock (pgdat, &flags); +for (i =0 ; i < pgdat->node_spanned_pages; i++) { +struct page *page; +unsigned long pfn = pgdat->node_start_pfn + i; + +if (unlikely ((i %MAX_ORDER_NR_PAGES ) ==0 )) +touch_nmi_watchdog (); + +if (!pfn_valid (pfn)) +continue ; + + page =pfn_to_page (pfn); + +if (PageHighMem (page)) + highmem++; + +if (PageReserved (page)) + reserved++; +else if (page_count (page) ==1 ) + nonshared++; +else if (page_count (page) >1 ) + shared +=page_count (page) -1 ; + + total++; + } +pgdat_resize_unlock (pgdat, &flags); + } + +printk (KERN_INFO "%lu pages RAM\n" , total); +#ifdef CONFIG_HIGHMEM +printk (KERN_INFO "%lu pages HighMem\n" , highmem); +#endif +printk (KERN_INFO "%lu pages reserved\n" , reserved); +printk (KERN_INFO "%lu pages shared\n" , shared); +printk (KERN_INFO "%lu pages non-shared\n" , nonshared); +#ifdef CONFIG_QUICKLIST +printk (KERN_INFO "%lu pages in pagetable cache\n" , +quicklist_total_size ()); +#endif +} +#endif /* CONFIG_HAVE_GENERIC_SHOW_MEM */ +/* * Builds allocation fallback zone lists. *
mm/Kconfig +3 -0
@@ -213,6 +213,9 @@ config VIRT_TO_BUS config PAGE_WALKER def_bool n +config HAVE_GENERIC_SHOW_MEM + def_bool n + config UNEVICTABLE_LRU bool "Add LRU list to track non-evictable pages" default y
Re: [PATCH 17/20] sparc64: use generic show_mem()
In reply to Johannes WeinerFrom: Johannes Weiner <[email protected]>
Date: Fri, 27 Jun 2008 13:54:06 +0200
Quoted 9 lines
Remove arch-specific
show_mem()in favor of the generic version.This also removes the following redundant information display:
- free swap pages, printed by
show_swap_cache_info()
- pages in swapcache, printed byshow_swap_cache_info()
- dirty pages, writeback pages, mapped pages, slab pages, pagetables pages, printed byshow_free_areas()
Quoted 5 lines
where
show_mem()callsshow_free_areas(), which callsshow_swap_cache_info().Signed-off-by Johannes Weiner <[email protected]>CC David S. Miller <[email protected]>
Thank you for doing this work:
Re: [PATCH 02/20] mm: generic show_mem()
In reply to Johannes WeinerQuoted 3 lines · Johannes Weiner
This implements a platform-independent version of
show_mem().Signed-off-by Johannes Weiner <[email protected]>
Looking at this again, does having this as a Kconfig option really make sense? We have no tristate in-tree users of this that I can see, wouldn't this be better off in lib/? It would be preferable not to let the HAVE_foo stuff get out of hand if we can avoid it.
Re: [PATCH 02/20] mm: generic show_mem()
Hi,
Quoted 9 lines · Paul Mundt
Quoted 3 lines · Johannes Weiner
This implements a platform-independent version of
show_mem().Signed-off-by Johannes Weiner <[email protected]>Looking at this again, does having this as a
Kconfigoption really make sense? We have no tristate in-tree users of this that I can see, wouldn't this be better off inlib/? It would be preferable not to let theHAVE_foostuff get out of hand if we can avoid it.
I hate the current Kconfig usage, too. But I figured, if I won't obey on such decisions by people who maintain it, it won't have a chance to get in.
So, what do you suggest? Moving it to lib/ and have one simple #define if the arch wants to use it or not?
Hannes
Re: [PATCH 02/20] mm: generic show_mem()
Quoted 11 lines · Johannes Weiner
Quoted 9 lines · Paul Mundt
Quoted 3 lines · Johannes Weiner
This implements a platform-independent version of
show_mem().Signed-off-by Johannes Weiner <[email protected]>Looking at this again, does having this as a
Kconfigoption really make sense? We have no tristate in-tree users of this that I can see, wouldn't this be better off inlib/? It would be preferable not to let theHAVE_foostuff get out of hand if we can avoid it.
Quoted 7 lines
I hate the current
Kconfigusage, too. But I figured, if I won't obey on such decisions by people who maintain it, it won't have a chance to get in.So, what do you suggest? Moving it to
lib/and have one simple #define if the arch wants to use it or not?
There's no need for a define. If you move it to lib/ it will just be the default implementation unless an architecture overloads it with their own definition. With your current patch set, you should just be able to shove it in to lib/, drop the Kconfig option, and be good to go.
Re: [PATCH 09/20] m68k: use generic show_mem()
In reply to Johannes WeinerQuoted 4 lines · Johannes Weiner
Remove arch-specific
show_mem()in favor of the generic version.This also removes the following redundant information display:
Quoted 8 lines
- free pages, printed by
show_free_areas()
- pages in swapcache, printed byshow_swap_cache_info()where
show_mem()callsshow_free_areas(), which callsshow_swap_cache_info().Signed-off-by Johannes Weiner <[email protected]>CC Geert Uytterhoeven <[email protected]>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Hi,
Quoted 8 lines · Johannes Weiner
Every arch implements its own
show_mem()function. Most of them share quite some code, some of them are completely identical.This series implements a generic version of this function and migrates almost all architectures to it.
version 4:
- rebased against -mmotm
Oh, btw, do you even want them, Andrew? Or should I base this set on Linus' tree directly?
Hannes
Andrew Morton
maintainerQuoted 7 lines · On Tue, 01 Jul 2008 08:55:27 +0200 Johannes Weiner <[email protected]> wrote:
Hi,
Quoted 3 lines · Johannes Weiner
Every arch implements its own
show_mem()function. Most of them share quite some code, some of them are completely identical.
Quoted 7 lines
Quoted 5 lines
This series implements a generic version of this function and migrates almost all architectures to it.
version 4:
- rebased against -mmotmOh, btw, do you even want them, Andrew?
These are only a few hundred patches ahead of my current backlog cursor :( I should be caught up mid-weekish.
Quoted 2 lines
Or should I base this set on
Linus' tree directly?
That would be a bad step. Linus's tree is 2.6.26 whereas we're all developing 2.6.27. There's a ~30MB diff between the two.
Re: [PATCH 14/20] powerpc: use generic show_mem()
In reply to Johannes WeinerQuoted 6 lines · Johannes Weiner
plain text document attachment (0015-powerpc-use-generic-show_mem.patch)
Remove arch-specificshow_mem()in favor of the generic version.This also removes the following redundant information display:
Quoted 7 lines
- pages in swapcache, printed by
show_swap_cache_info()where
show_mem()callsshow_free_areas(), which callsshow_swap_cache_info().Signed-off-by Johannes Weiner <[email protected]>CC Paul Mackerras <[email protected]>
Looks good to me. Paul, do you know of any userland thingy that might be unhappy by the change from "%d pages of XXX" to "%d pages RAM" and "%d reserved pages" to "%s pages reserved" ?
Cheers,
Ben.
Quoted 64 lines
--- arch/powerpc/Kconfig | 1 + arch/powerpc/mm/mem.c | 39 --------------------------------------- 2 files changed, 1 insertion(+), 39 deletions(-)arch/powerpc/Kconfig +1
-0@@ -114,6 +114,7 @@ config PPC select HAVE_KRETPROBES select HAVE_LMB select HAVE_OPROFILE + select HAVE_GENERIC_SHOW_MEM select USE_GENERIC_SMP_HELPERS if SMP config EARLY_PRINTKarch/powerpc/mm/mem.c +0
-39@@ -185,45 +185,6 @@ walk_memory_resource(unsigned long start }EXPORT_SYMBOL_GPL (walk_memory_resource); -void show_mem (void ) -{ -unsigned long total =0 , reserved =0 ; -unsigned long shared =0 , cached =0 ; -unsigned long highmem =0 ; -struct page *page; -pg_data_t *pgdat; -unsigned long i; - -printk ("Mem-info:\n" ); -show_free_areas (); -for_each_online_pgdat (pgdat) { -unsigned long flags; -pgdat_resize_lock (pgdat, &flags); -for (i =0 ; i < pgdat->node_spanned_pages; i++) { -if (!pfn_valid (pgdat->node_start_pfn + i)) -continue ; - page =pgdat_page_nr (pgdat, i); - total++; -if (PageHighMem (page)) - highmem++; -if (PageReserved (page)) - reserved++; -else if (PageSwapCache (page)) - cached++; -else if (page_count (page)) - shared +=page_count (page) -1 ; - } -pgdat_resize_unlock (pgdat, &flags); - } -printk ("%ld pages of RAM\n" , total); -#ifdef CONFIG_HIGHMEM -printk ("%ld pages of HIGHMEM\n" , highmem); -#endif -printk ("%ld reserved pages\n" , reserved); -printk ("%ld pages shared\n" , shared); -printk ("%ld pages swap cached\n" , cached); -} -/* * Initialize the bootmem system and give it all the memory we * have available. If we are using highmem, we only put the
Hi,
Quoted 17 lines · Andrew Morton
Quoted 7 lines · On Tue, 01 Jul 2008 08:55:27 +0200 Johannes Weiner <[email protected]> wrote:
Hi,
Quoted 3 lines · Johannes Weiner
Every arch implements its own
show_mem()function. Most of them share quite some code, some of them are completely identical.Quoted 7 lines
Quoted 5 lines
This series implements a generic version of this function and migrates almost all architectures to it.
version 4:
- rebased against -mmotmOh, btw, do you even want them, Andrew?
Quoted 8 lines
These are only a few hundred patches ahead of my current backlog cursor :( I should be caught up mid-weekish.
Quoted 2 lines
Or should I base this set on
Linus' tree directly?That would be a bad step. Linus's tree is 2.6.26 whereas we're all developing 2.6.27. There's a ~30MB diff between the two.
Alright, I will keep them against -mmotm and resend them soon without the Kconfig stuff as suggested by Paul Mundt.
Hannes