From: Jiang Liu <liuj97@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiang Liu <jiang.liu@huawei.com>,
David Rientjes <rientjes@google.com>,
Wen Congyang <wency@cn.fujitsu.com>, Mel Gorman <mgorman@suse.de>,
Minchan Kim <minchan@kernel.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Michal Hocko <mhocko@suse.cz>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
David Howells <dhowells@redhat.com>,
Mark Salter <msalter@redhat.com>,
Jianguo Wu <wujianguo@huawei.com>,
linux-mm@kvack.org, linux-arch@vger.kernel.org,
linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Andreas Herrmann <andreas.herrmann3@amd.com>,
Tang Chen <tangchen@cn.fujitsu.com>
Subject: [PATCH v5, part4 39/41] mm/x86: prepare for removing num_physpages and simplify mem_init()
Date: Wed, 8 May 2013 23:51:36 +0800 [thread overview]
Message-ID: <1368028298-7401-40-git-send-email-jiang.liu@huawei.com> (raw)
In-Reply-To: <1368028298-7401-1-git-send-email-jiang.liu@huawei.com>
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Jianguo Wu <wujianguo@huawei.com>
Cc: linux-kernel@vger.kernel.org
---
arch/x86/kernel/cpu/amd.c | 2 +-
arch/x86/kernel/setup.c | 2 --
arch/x86/mm/init_32.c | 30 ++----------------------------
arch/x86/mm/init_64.c | 20 +-------------------
arch/x86/mm/numa_32.c | 2 --
5 files changed, 4 insertions(+), 52 deletions(-)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 5013a48..c587a87 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -90,7 +90,7 @@ static void __cpuinit init_amd_k5(struct cpuinfo_x86 *c)
static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c)
{
u32 l, h;
- int mbytes = num_physpages >> (20-PAGE_SHIFT);
+ int mbytes = get_num_physpages() >> (20-PAGE_SHIFT);
if (c->x86_model < 6) {
/* Based on AMD doc 20734R - June 2000 */
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index c8dbdfd..58f1a8ad 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1041,8 +1041,6 @@ void __init setup_arch(char **cmdline_p)
/* max_low_pfn get updated here */
find_low_pfn_range();
#else
- num_physpages = max_pfn;
-
check_x2apic();
/* How many end-of-memory variables you have, grandma! */
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 9fa46ba..4287f1f 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -660,10 +660,8 @@ void __init initmem_init(void)
highstart_pfn = max_low_pfn;
printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
pages_to_mb(highend_pfn - highstart_pfn));
- num_physpages = highend_pfn;
high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
#else
- num_physpages = max_low_pfn;
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
#endif
@@ -671,7 +669,7 @@ void __init initmem_init(void)
sparse_memory_present_with_active_regions(0);
#ifdef CONFIG_FLATMEM
- max_mapnr = num_physpages;
+ max_mapnr = IS_ENABLED(CONFIG_HIGHMEM) ? highend_pfn : max_low_pfn;
#endif
__vmalloc_start_set = true;
@@ -739,9 +737,6 @@ static void __init test_wp_bit(void)
void __init mem_init(void)
{
- int codesize, reservedpages, datasize, initsize;
- int tmp;
-
pci_iommu_alloc();
#ifdef CONFIG_FLATMEM
@@ -761,30 +756,9 @@ void __init mem_init(void)
/* this will put all low memory onto the freelists */
free_all_bootmem();
- reservedpages = 0;
- for (tmp = 0; tmp < max_low_pfn; tmp++)
- /*
- * Only count reserved RAM pages:
- */
- if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp)))
- reservedpages++;
-
after_bootmem = 1;
- codesize = (unsigned long) &_etext - (unsigned long) &_text;
- datasize = (unsigned long) &_edata - (unsigned long) &_etext;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
- printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
- "%dk reserved, %dk data, %dk init, %ldk highmem)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- num_physpages << (PAGE_SHIFT-10),
- codesize >> 10,
- reservedpages << (PAGE_SHIFT-10),
- datasize >> 10,
- initsize >> 10,
- totalhigh_pages << (PAGE_SHIFT-10));
-
+ mem_init_print_info(NULL);
printk(KERN_INFO "virtual kernel memory layout:\n"
" fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
#ifdef CONFIG_HIGHMEM
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 65116e5..650264b 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1043,9 +1043,6 @@ static void __init register_page_bootmem_info(void)
void __init mem_init(void)
{
- long codesize, reservedpages, datasize, initsize;
- unsigned long absent_pages;
-
pci_iommu_alloc();
/* clear_bss() already clear the empty_zero_page */
@@ -1054,28 +1051,13 @@ void __init mem_init(void)
/* this will put all memory onto the freelists */
free_all_bootmem();
-
- absent_pages = absent_pages_in_range(0, max_pfn);
- reservedpages = max_pfn - totalram_pages - absent_pages;
after_bootmem = 1;
- codesize = (unsigned long) &_etext - (unsigned long) &_text;
- datasize = (unsigned long) &_edata - (unsigned long) &_etext;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
/* Register memory areas for /proc/kcore */
kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START,
VSYSCALL_END - VSYSCALL_START, KCORE_OTHER);
- printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
- "%ldk absent, %ldk reserved, %ldk data, %ldk init)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- max_pfn << (PAGE_SHIFT-10),
- codesize >> 10,
- absent_pages << (PAGE_SHIFT-10),
- reservedpages << (PAGE_SHIFT-10),
- datasize >> 10,
- initsize >> 10);
+ mem_init_print_info(NULL);
}
#ifdef CONFIG_DEBUG_RODATA
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
index 73a6d73..0342d27 100644
--- a/arch/x86/mm/numa_32.c
+++ b/arch/x86/mm/numa_32.c
@@ -83,10 +83,8 @@ void __init initmem_init(void)
highstart_pfn = max_low_pfn;
printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
pages_to_mb(highend_pfn - highstart_pfn));
- num_physpages = highend_pfn;
high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
#else
- num_physpages = max_low_pfn;
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
#endif
printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2013-05-08 15:57 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
2013-05-08 15:50 ` [PATCH v5, part4 01/41] vmlinux.lds: add comments for global variables and clean up useless declarations Jiang Liu
2013-05-08 15:50 ` [PATCH v5, part4 02/41] avr32: normalize global variables exported by vmlinux.lds Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 03/41] c6x: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 04/41] h8300: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 05/41] score: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 06/41] tile: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 07/41] UML: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 08/41] mm: introduce helper function mem_init_print_info() to simplify mem_init() Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 09/41] mm: use totalram_pages instead of num_physpages at runtime Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 10/41] mm/hotplug: prepare for removing num_physpages Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 11/41] mm/alpha: prepare for removing num_physpages and simplify mem_init() Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 12/41] mm/ARC: " Jiang Liu
2013-05-29 8:41 ` Vineet Gupta
2013-05-29 13:05 ` Liu Jiang
2013-05-08 15:51 ` [PATCH v5, part4 13/41] mm/ARM: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 14/41] mm/ARM64: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 15/41] mm/AVR32: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 16/41] mm/blackfin: " Jiang Liu
2013-05-25 13:25 ` Sonic Zhang
2013-05-26 13:55 ` Liu Jiang
2013-05-08 15:51 ` [PATCH v5, part4 17/41] mm/c6x: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 18/41] mm/cris: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 19/41] mm/frv: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 20/41] mm/h8300: " Jiang Liu
2013-05-08 16:26 ` Sergei Shtylyov
2013-05-08 19:29 ` Sergei Shtylyov
2013-05-08 23:35 ` Cody P Schafer
2013-05-12 15:17 ` Liu Jiang
2013-05-08 15:51 ` [PATCH v5, part4 21/41] mm/hexagon: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 22/41] mm/IA64: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 23/41] mm/m32r: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 24/41] mm/m68k: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 25/41] mm/metag: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 26/41] mm/microblaze: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 27/41] mm/MIPS: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 28/41] mm/mn10300: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 29/41] mm/openrisc: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 30/41] mm/PARISC: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 31/41] mm/ppc: " Jiang Liu
2013-05-15 0:32 ` Benjamin Herrenschmidt
2013-05-15 15:49 ` Liu Jiang
2013-05-08 15:51 ` [PATCH v5, part4 32/41] mm/s390: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 33/41] mm/score: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 34/41] mm/SH: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 35/41] mm/SPARC: " Jiang Liu
2013-05-08 19:02 ` Sam Ravnborg
2013-05-08 15:51 ` [PATCH v5, part4 36/41] mm/tile: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 37/41] mm/um: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 38/41] mm/unicore32: " Jiang Liu
2013-05-08 15:51 ` Jiang Liu [this message]
2013-05-08 15:51 ` [PATCH v5, part4 40/41] mm/xtensa: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 41/41] mm: kill global variable num_physpages Jiang Liu
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=1368028298-7401-40-git-send-email-jiang.liu@huawei.com \
--to=liuj97@gmail.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=akpm@linux-foundation.org \
--cc=andreas.herrmann3@amd.com \
--cc=dhowells@redhat.com \
--cc=hpa@zytor.com \
--cc=jiang.liu@huawei.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
--cc=minchan@kernel.org \
--cc=mingo@redhat.com \
--cc=msalter@redhat.com \
--cc=rientjes@google.com \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=tangchen@cn.fujitsu.com \
--cc=tglx@linutronix.de \
--cc=wency@cn.fujitsu.com \
--cc=wujianguo@huawei.com \
--cc=x86@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;
as well as URLs for NNTP newsgroup(s).