diff options
author | Jiang Liu <liuj97@gmail.com> | 2013-07-03 18:03:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 19:07:35 -0400 |
commit | de35e1b828cb21d027265847ca32e5b9cff1c1e9 (patch) | |
tree | d92d2c7cea6f5b3192eaf2170752f73a23965f2d /arch/arc | |
parent | d385d9ee7add81254cb7094d616138089ea500f5 (diff) |
mm/ARC: prepare for removing num_physpages and simplify mem_init()
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com> # for arch/arc
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/arc')
-rw-r--r-- | arch/arc/mm/init.c | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c index c668a600f652..a08ce7185423 100644 --- a/arch/arc/mm/init.c +++ b/arch/arc/mm/init.c | |||
@@ -74,7 +74,7 @@ void __init setup_arch_memory(void) | |||
74 | /* Last usable page of low mem (no HIGHMEM yet for ARC port) */ | 74 | /* Last usable page of low mem (no HIGHMEM yet for ARC port) */ |
75 | max_low_pfn = max_pfn = PFN_DOWN(end_mem); | 75 | max_low_pfn = max_pfn = PFN_DOWN(end_mem); |
76 | 76 | ||
77 | max_mapnr = num_physpages = max_low_pfn - min_low_pfn; | 77 | max_mapnr = max_low_pfn - min_low_pfn; |
78 | 78 | ||
79 | /*------------- reserve kernel image -----------------------*/ | 79 | /*------------- reserve kernel image -----------------------*/ |
80 | memblock_reserve(CONFIG_LINUX_LINK_BASE, | 80 | memblock_reserve(CONFIG_LINUX_LINK_BASE, |
@@ -84,7 +84,7 @@ void __init setup_arch_memory(void) | |||
84 | 84 | ||
85 | /*-------------- node setup --------------------------------*/ | 85 | /*-------------- node setup --------------------------------*/ |
86 | memset(zones_size, 0, sizeof(zones_size)); | 86 | memset(zones_size, 0, sizeof(zones_size)); |
87 | zones_size[ZONE_NORMAL] = num_physpages; | 87 | zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn; |
88 | 88 | ||
89 | /* | 89 | /* |
90 | * We can't use the helper free_area_init(zones[]) because it uses | 90 | * We can't use the helper free_area_init(zones[]) because it uses |
@@ -106,39 +106,9 @@ void __init setup_arch_memory(void) | |||
106 | */ | 106 | */ |
107 | void __init mem_init(void) | 107 | void __init mem_init(void) |
108 | { | 108 | { |
109 | int codesize, datasize, initsize, reserved_pages, free_pages; | ||
110 | int tmp; | ||
111 | |||
112 | high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz); | 109 | high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz); |
113 | |||
114 | free_all_bootmem(); | 110 | free_all_bootmem(); |
115 | 111 | mem_init_print_info(NULL); | |
116 | /* count all reserved pages [kernel code/data/mem_map..] */ | ||
117 | reserved_pages = 0; | ||
118 | for (tmp = 0; tmp < max_mapnr; tmp++) | ||
119 | if (PageReserved(mem_map + tmp)) | ||
120 | reserved_pages++; | ||
121 | |||
122 | /* XXX: nr_free_pages() is equivalent */ | ||
123 | free_pages = max_mapnr - reserved_pages; | ||
124 | |||
125 | /* | ||
126 | * For the purpose of display below, split the "reserve mem" | ||
127 | * kernel code/data is already shown explicitly, | ||
128 | * Show any other reservations (mem_map[ ] et al) | ||
129 | */ | ||
130 | reserved_pages -= (((unsigned int)_end - CONFIG_LINUX_LINK_BASE) >> | ||
131 | PAGE_SHIFT); | ||
132 | |||
133 | codesize = _etext - _text; | ||
134 | datasize = _end - _etext; | ||
135 | initsize = __init_end - __init_begin; | ||
136 | |||
137 | pr_info("Memory Available: %dM / %ldM (%dK code, %dK data, %dK init, %dK reserv)\n", | ||
138 | PAGES_TO_MB(free_pages), | ||
139 | TO_MB(arc_mem_sz), | ||
140 | TO_KB(codesize), TO_KB(datasize), TO_KB(initsize), | ||
141 | PAGES_TO_KB(reserved_pages)); | ||
142 | } | 112 | } |
143 | 113 | ||
144 | /* | 114 | /* |