From: Johannes Weiner <hannes@saeurebad.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>
Subject: [patch 21/22 -v3] x86: Use generic show_mem()
Date: Mon, 07 Apr 2008 16:40:29 +0200 [thread overview]
Message-ID: <20080407144242.183798381@skyscraper.fehenstaub.lan> (raw)
In-Reply-To: <20080407144008.124362640@skyscraper.fehenstaub.lan>
[-- Attachment #1: x86-use-generic-show_mem.patch --]
[-- Type: text/plain, Size: 4047 bytes --]
Remove 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().
Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
---
Index: tree-linus/arch/x86/mm/pgtable_32.c
===================================================================
--- tree-linus.orig/arch/x86/mm/pgtable_32.c
+++ tree-linus/arch/x86/mm/pgtable_32.c
@@ -24,53 +24,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.
Index: tree-linus/arch/x86/mm/init_64.c
===================================================================
--- tree-linus.orig/arch/x86/mm/init_64.c
+++ tree-linus/arch/x86/mm/init_64.c
@@ -60,43 +60,6 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_ga
* 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)
Index: tree-linus/arch/x86/Kconfig
===================================================================
--- tree-linus.orig/arch/x86/Kconfig
+++ tree-linus/arch/x86/Kconfig
@@ -23,6 +23,7 @@ config X86
select HAVE_KPROBES
select HAVE_KRETPROBES
select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
+ select HAVE_GENERIC_SHOW_MEM
config GENERIC_LOCKBREAK
--
next prev parent reply other threads:[~2008-04-07 15:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-07 14:40 [patch 00/22 -v3] Generic show_mem() Johannes Weiner
2008-04-07 14:40 ` [patch 01/22 -v3] Print current swapcache page count in show_swap_cache_info() Johannes Weiner
2008-04-07 14:40 ` [patch 02/22 -v3] Generic show_mem() implementation Johannes Weiner
2008-04-07 14:40 ` [patch 03/22 -v3] alpha: Use generic show_mem() Johannes Weiner
2008-04-07 14:40 ` [patch 04/22 -v3] avr32: " Johannes Weiner
2008-04-07 14:40 ` [patch 05/22 -v3] blackfin: " Johannes Weiner
2008-04-07 14:40 ` [patch 06/22 -v3] cris: " Johannes Weiner
2008-04-07 14:40 ` [patch 07/22 -v3] frv: " Johannes Weiner
2008-04-07 14:40 ` [patch 08/22 -v3] h8300: " Johannes Weiner
2008-04-07 14:40 ` [patch 09/22 -v3] m32r: " Johannes Weiner
2008-04-07 14:40 ` [patch 10/22 -v3] m68k: " Johannes Weiner
2008-04-07 14:40 ` [patch 11/22 -v3] m68knommu: " Johannes Weiner
2008-04-07 14:40 ` [patch 12/22 -v3] mips: " Johannes Weiner
2008-04-07 14:40 ` [patch 13/22 -v3] mn10300: " Johannes Weiner
2008-04-07 14:40 ` [patch 14/22 -v3] powerpc: " Johannes Weiner
2008-04-07 14:40 ` [patch 15/22 -v3] ppc: " Johannes Weiner
2008-04-07 14:40 ` [patch 16/22 -v3] s390: " Johannes Weiner
2008-04-07 14:40 ` [patch 17/22 -v3] sh: " Johannes Weiner
2008-04-07 14:40 ` [patch 18/22 -v3] sparc64: " Johannes Weiner
2008-04-07 14:40 ` [patch 19/22 -v3] um: " Johannes Weiner
2008-04-07 14:40 ` [patch 20/22 -v3] v850: " Johannes Weiner
2008-04-07 14:40 ` Johannes Weiner [this message]
2008-04-07 14:40 ` [patch 22/22 -v3] xtensa: " Johannes Weiner
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=20080407144242.183798381@skyscraper.fehenstaub.lan \
--to=hannes@saeurebad.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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
all inboxes | Powered by JetHome®