From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 06/11] showmem: Only walk spanned pages.
Date: Thu, 29 May 2008 14:55:07 +0200 [thread overview]
Message-ID: <20080529125729.607377419@de.ibm.com> (raw)
In-Reply-To: 20080529125501.196123527@de.ibm.com
[-- Attachment #1: 006-showmem.diff --]
[-- Type: text/plain, Size: 2398 bytes --]
From: Heiko Carstens <heiko.carstens@de.ibm.com>
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.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
arch/s390/mm/init.c | 42 +++++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 19 deletions(-)
Index: quilt-2.6/arch/s390/mm/init.c
===================================================================
--- quilt-2.6.orig/arch/s390/mm/init.c
+++ quilt-2.6/arch/s390/mm/init.c
@@ -44,30 +44,34 @@ char empty_zero_page[PAGE_SIZE] __attri
void show_mem(void)
{
- int i, total = 0, reserved = 0;
- int shared = 0, cached = 0;
+ 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();
- i = max_mapnr;
- while (i-- > 0) {
- if (!pfn_valid(i))
- continue;
- page = pfn_to_page(i);
- total++;
- if (PageReserved(page))
- reserved++;
- else if (PageSwapCache(page))
- cached++;
- else if (page_count(page))
- shared += page_count(page) - 1;
+ 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("%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("%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);
printk("%lu pages dirty\n", global_page_state(NR_FILE_DIRTY));
printk("%lu pages writeback\n", global_page_state(NR_WRITEBACK));
printk("%lu pages mapped\n", global_page_state(NR_FILE_MAPPED));
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
next prev parent reply other threads:[~2008-05-29 12:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-29 12:55 [patch 00/11] s390 bug fixes for 2.6.26-rc4 Martin Schwidefsky
2008-05-29 12:55 ` [patch 01/11] fix sparsemem related compile error with allnoconfig on s390 Martin Schwidefsky
2008-05-29 12:55 ` [patch 02/11] tape: Fix race condition in tape block device driver Martin Schwidefsky
2008-05-29 12:55 ` [patch 03/11] s390 types: make dma_addr_t 64 bit capable Martin Schwidefsky
2008-05-29 12:55 ` [patch 04/11] Fix section mismatch warnings Martin Schwidefsky
2008-05-29 12:55 ` [patch 05/11] appldata: prevent cpu hotplug when walking cpu_online_map Martin Schwidefsky
2008-05-29 12:55 ` Martin Schwidefsky [this message]
2008-05-29 17:20 ` [patch 06/11] showmem: Only walk spanned pages Johannes Weiner
2008-05-30 5:50 ` Heiko Carstens
2008-05-30 6:13 ` Johannes Weiner
2008-05-29 12:55 ` [patch 07/11] sclp_vt220: fix scheduling while atomic bug Martin Schwidefsky
2008-05-29 12:55 ` [patch 08/11] dasd: use a generic wait_queue for sleep_on Martin Schwidefsky
2008-05-29 12:55 ` [patch 09/11] 3270: fix race with stack local wait_queue_head_t Martin Schwidefsky
2008-05-29 12:55 ` [patch 10/11] tape: " Martin Schwidefsky
2008-05-29 12:55 ` [patch 11/11] disassembler: fix idte instruction format Martin Schwidefsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080529125729.607377419@de.ibm.com \
--to=schwidefsky@de.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox