1
0
Fork 0

[S390] showmem: Only walk spanned pages.

Convert show_mem() so its nearly the same as on x86/powerpc.
Gives us proper locking and we get also rid of the only use of max_mapnr.
Also the number of pages was contained in an int which might not be
sufficient not too far in the future.

Cc: Johannes Weiner <hannes@saeurebad.de>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
hifive-unleashed-5.1
Heiko Carstens 2008-05-30 10:03:29 +02:00 committed by Martin Schwidefsky
parent 1760537b69
commit c1bb7f31ea
1 changed files with 23 additions and 26 deletions

View File

@ -44,17 +44,20 @@ char empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
void show_mem(void) void show_mem(void)
{ {
int i, total = 0, reserved = 0; unsigned long i, total = 0, reserved = 0;
int shared = 0, cached = 0; unsigned long shared = 0, cached = 0;
unsigned long flags;
struct page *page; struct page *page;
pg_data_t *pgdat;
printk("Mem-info:\n"); printk("Mem-info:\n");
show_free_areas(); show_free_areas();
i = max_mapnr; for_each_online_pgdat(pgdat) {
while (i-- > 0) { pgdat_resize_lock(pgdat, &flags);
if (!pfn_valid(i)) for (i = 0; i < pgdat->node_spanned_pages; i++) {
if (!pfn_valid(pgdat->node_start_pfn + i))
continue; continue;
page = pfn_to_page(i); page = pfn_to_page(pgdat->node_start_pfn + i);
total++; total++;
if (PageReserved(page)) if (PageReserved(page))
reserved++; reserved++;
@ -63,18 +66,12 @@ void show_mem(void)
else if (page_count(page)) else if (page_count(page))
shared += page_count(page) - 1; shared += page_count(page) - 1;
} }
printk("%d pages of RAM\n", total); pgdat_resize_unlock(pgdat, &flags);
printk("%d reserved pages\n", reserved); }
printk("%d pages shared\n", shared); printk("%ld pages of RAM\n", total);
printk("%d pages swap cached\n", cached); printk("%ld reserved pages\n", reserved);
printk("%ld pages shared\n", shared);
printk("%lu pages dirty\n", global_page_state(NR_FILE_DIRTY)); printk("%ld pages swap cached\n", cached);
printk("%lu pages writeback\n", global_page_state(NR_WRITEBACK));
printk("%lu pages mapped\n", global_page_state(NR_FILE_MAPPED));
printk("%lu pages slab\n",
global_page_state(NR_SLAB_RECLAIMABLE) +
global_page_state(NR_SLAB_UNRECLAIMABLE));
printk("%lu pages pagetables\n", global_page_state(NR_PAGETABLE));
} }
/* /*