diff options
40 files changed, 96 insertions, 79 deletions
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c index 486d7945583d..544ac5dc09eb 100644 --- a/arch/alpha/mm/init.c +++ b/arch/alpha/mm/init.c | |||
@@ -357,7 +357,7 @@ free_reserved_mem(void *start, void *end) | |||
357 | void *__start = start; | 357 | void *__start = start; |
358 | for (; __start < end; __start += PAGE_SIZE) { | 358 | for (; __start < end; __start += PAGE_SIZE) { |
359 | ClearPageReserved(virt_to_page(__start)); | 359 | ClearPageReserved(virt_to_page(__start)); |
360 | set_page_count(virt_to_page(__start), 1); | 360 | init_page_count(virt_to_page(__start)); |
361 | free_page((long)__start); | 361 | free_page((long)__start); |
362 | totalram_pages++; | 362 | totalram_pages++; |
363 | } | 363 | } |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 8b276ee38acf..b0321e943b76 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -531,7 +531,7 @@ static inline void free_area(unsigned long addr, unsigned long end, char *s) | |||
531 | for (; addr < end; addr += PAGE_SIZE) { | 531 | for (; addr < end; addr += PAGE_SIZE) { |
532 | struct page *page = virt_to_page(addr); | 532 | struct page *page = virt_to_page(addr); |
533 | ClearPageReserved(page); | 533 | ClearPageReserved(page); |
534 | set_page_count(page, 1); | 534 | init_page_count(page); |
535 | free_page(addr); | 535 | free_page(addr); |
536 | totalram_pages++; | 536 | totalram_pages++; |
537 | } | 537 | } |
diff --git a/arch/arm26/mm/init.c b/arch/arm26/mm/init.c index 1f09a9d0fb83..e3ecaa453747 100644 --- a/arch/arm26/mm/init.c +++ b/arch/arm26/mm/init.c | |||
@@ -324,7 +324,7 @@ static inline void free_area(unsigned long addr, unsigned long end, char *s) | |||
324 | for (; addr < end; addr += PAGE_SIZE) { | 324 | for (; addr < end; addr += PAGE_SIZE) { |
325 | struct page *page = virt_to_page(addr); | 325 | struct page *page = virt_to_page(addr); |
326 | ClearPageReserved(page); | 326 | ClearPageReserved(page); |
327 | set_page_count(page, 1); | 327 | init_page_count(page); |
328 | free_page(addr); | 328 | free_page(addr); |
329 | totalram_pages++; | 329 | totalram_pages++; |
330 | } | 330 | } |
diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c index 31a0018b525a..b7842ff213a6 100644 --- a/arch/cris/mm/init.c +++ b/arch/cris/mm/init.c | |||
@@ -216,7 +216,7 @@ free_initmem(void) | |||
216 | addr = (unsigned long)(&__init_begin); | 216 | addr = (unsigned long)(&__init_begin); |
217 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { | 217 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { |
218 | ClearPageReserved(virt_to_page(addr)); | 218 | ClearPageReserved(virt_to_page(addr)); |
219 | set_page_count(virt_to_page(addr), 1); | 219 | init_page_count(virt_to_page(addr)); |
220 | free_page(addr); | 220 | free_page(addr); |
221 | totalram_pages++; | 221 | totalram_pages++; |
222 | } | 222 | } |
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c index 765088ea8a50..8899aa1a4f06 100644 --- a/arch/frv/mm/init.c +++ b/arch/frv/mm/init.c | |||
@@ -169,7 +169,7 @@ void __init mem_init(void) | |||
169 | struct page *page = &mem_map[pfn]; | 169 | struct page *page = &mem_map[pfn]; |
170 | 170 | ||
171 | ClearPageReserved(page); | 171 | ClearPageReserved(page); |
172 | set_page_count(page, 1); | 172 | init_page_count(page); |
173 | __free_page(page); | 173 | __free_page(page); |
174 | totalram_pages++; | 174 | totalram_pages++; |
175 | } | 175 | } |
@@ -210,7 +210,7 @@ void __init free_initmem(void) | |||
210 | /* next to check that the page we free is not a partial page */ | 210 | /* next to check that the page we free is not a partial page */ |
211 | for (addr = start; addr < end; addr += PAGE_SIZE) { | 211 | for (addr = start; addr < end; addr += PAGE_SIZE) { |
212 | ClearPageReserved(virt_to_page(addr)); | 212 | ClearPageReserved(virt_to_page(addr)); |
213 | set_page_count(virt_to_page(addr), 1); | 213 | init_page_count(virt_to_page(addr)); |
214 | free_page(addr); | 214 | free_page(addr); |
215 | totalram_pages++; | 215 | totalram_pages++; |
216 | } | 216 | } |
@@ -230,7 +230,7 @@ void __init free_initrd_mem(unsigned long start, unsigned long end) | |||
230 | int pages = 0; | 230 | int pages = 0; |
231 | for (; start < end; start += PAGE_SIZE) { | 231 | for (; start < end; start += PAGE_SIZE) { |
232 | ClearPageReserved(virt_to_page(start)); | 232 | ClearPageReserved(virt_to_page(start)); |
233 | set_page_count(virt_to_page(start), 1); | 233 | init_page_count(virt_to_page(start)); |
234 | free_page(start); | 234 | free_page(start); |
235 | totalram_pages++; | 235 | totalram_pages++; |
236 | pages++; | 236 | pages++; |
diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c index 1e0929ddc8c4..09efc4b1f038 100644 --- a/arch/h8300/mm/init.c +++ b/arch/h8300/mm/init.c | |||
@@ -196,7 +196,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
196 | int pages = 0; | 196 | int pages = 0; |
197 | for (; start < end; start += PAGE_SIZE) { | 197 | for (; start < end; start += PAGE_SIZE) { |
198 | ClearPageReserved(virt_to_page(start)); | 198 | ClearPageReserved(virt_to_page(start)); |
199 | set_page_count(virt_to_page(start), 1); | 199 | init_page_count(virt_to_page(start)); |
200 | free_page(start); | 200 | free_page(start); |
201 | totalram_pages++; | 201 | totalram_pages++; |
202 | pages++; | 202 | pages++; |
@@ -219,7 +219,7 @@ free_initmem() | |||
219 | /* next to check that the page we free is not a partial page */ | 219 | /* next to check that the page we free is not a partial page */ |
220 | for (; addr + PAGE_SIZE < (unsigned long)(&__init_end); addr +=PAGE_SIZE) { | 220 | for (; addr + PAGE_SIZE < (unsigned long)(&__init_end); addr +=PAGE_SIZE) { |
221 | ClearPageReserved(virt_to_page(addr)); | 221 | ClearPageReserved(virt_to_page(addr)); |
222 | set_page_count(virt_to_page(addr), 1); | 222 | init_page_count(virt_to_page(addr)); |
223 | free_page(addr); | 223 | free_page(addr); |
224 | totalram_pages++; | 224 | totalram_pages++; |
225 | } | 225 | } |
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index 2700f01994ba..7ba55a6e2dbc 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c | |||
@@ -270,7 +270,7 @@ static void __init permanent_kmaps_init(pgd_t *pgd_base) | |||
270 | 270 | ||
271 | static void __meminit free_new_highpage(struct page *page) | 271 | static void __meminit free_new_highpage(struct page *page) |
272 | { | 272 | { |
273 | set_page_count(page, 1); | 273 | init_page_count(page); |
274 | __free_page(page); | 274 | __free_page(page); |
275 | totalhigh_pages++; | 275 | totalhigh_pages++; |
276 | } | 276 | } |
@@ -727,7 +727,7 @@ void free_initmem(void) | |||
727 | addr = (unsigned long)(&__init_begin); | 727 | addr = (unsigned long)(&__init_begin); |
728 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { | 728 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { |
729 | ClearPageReserved(virt_to_page(addr)); | 729 | ClearPageReserved(virt_to_page(addr)); |
730 | set_page_count(virt_to_page(addr), 1); | 730 | init_page_count(virt_to_page(addr)); |
731 | memset((void *)addr, 0xcc, PAGE_SIZE); | 731 | memset((void *)addr, 0xcc, PAGE_SIZE); |
732 | free_page(addr); | 732 | free_page(addr); |
733 | totalram_pages++; | 733 | totalram_pages++; |
@@ -766,7 +766,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
766 | printk (KERN_INFO "Freeing initrd memory: %ldk freed\n", (end - start) >> 10); | 766 | printk (KERN_INFO "Freeing initrd memory: %ldk freed\n", (end - start) >> 10); |
767 | for (; start < end; start += PAGE_SIZE) { | 767 | for (; start < end; start += PAGE_SIZE) { |
768 | ClearPageReserved(virt_to_page(start)); | 768 | ClearPageReserved(virt_to_page(start)); |
769 | set_page_count(virt_to_page(start), 1); | 769 | init_page_count(virt_to_page(start)); |
770 | free_page(start); | 770 | free_page(start); |
771 | totalram_pages++; | 771 | totalram_pages++; |
772 | } | 772 | } |
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c index b38b6d213c15..08d94e6bfa18 100644 --- a/arch/ia64/mm/init.c +++ b/arch/ia64/mm/init.c | |||
@@ -197,7 +197,7 @@ free_initmem (void) | |||
197 | eaddr = (unsigned long) ia64_imva(__init_end); | 197 | eaddr = (unsigned long) ia64_imva(__init_end); |
198 | while (addr < eaddr) { | 198 | while (addr < eaddr) { |
199 | ClearPageReserved(virt_to_page(addr)); | 199 | ClearPageReserved(virt_to_page(addr)); |
200 | set_page_count(virt_to_page(addr), 1); | 200 | init_page_count(virt_to_page(addr)); |
201 | free_page(addr); | 201 | free_page(addr); |
202 | ++totalram_pages; | 202 | ++totalram_pages; |
203 | addr += PAGE_SIZE; | 203 | addr += PAGE_SIZE; |
@@ -252,7 +252,7 @@ free_initrd_mem (unsigned long start, unsigned long end) | |||
252 | continue; | 252 | continue; |
253 | page = virt_to_page(start); | 253 | page = virt_to_page(start); |
254 | ClearPageReserved(page); | 254 | ClearPageReserved(page); |
255 | set_page_count(page, 1); | 255 | init_page_count(page); |
256 | free_page(start); | 256 | free_page(start); |
257 | ++totalram_pages; | 257 | ++totalram_pages; |
258 | } | 258 | } |
@@ -640,7 +640,7 @@ mem_init (void) | |||
640 | void online_page(struct page *page) | 640 | void online_page(struct page *page) |
641 | { | 641 | { |
642 | ClearPageReserved(page); | 642 | ClearPageReserved(page); |
643 | set_page_count(page, 1); | 643 | init_page_count(page); |
644 | __free_page(page); | 644 | __free_page(page); |
645 | totalram_pages++; | 645 | totalram_pages++; |
646 | num_physpages++; | 646 | num_physpages++; |
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c index 6facf15b04f3..c9e7dad860b7 100644 --- a/arch/m32r/mm/init.c +++ b/arch/m32r/mm/init.c | |||
@@ -226,7 +226,7 @@ void free_initmem(void) | |||
226 | addr = (unsigned long)(&__init_begin); | 226 | addr = (unsigned long)(&__init_begin); |
227 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { | 227 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { |
228 | ClearPageReserved(virt_to_page(addr)); | 228 | ClearPageReserved(virt_to_page(addr)); |
229 | set_page_count(virt_to_page(addr), 1); | 229 | init_page_count(virt_to_page(addr)); |
230 | free_page(addr); | 230 | free_page(addr); |
231 | totalram_pages++; | 231 | totalram_pages++; |
232 | } | 232 | } |
@@ -244,7 +244,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
244 | unsigned long p; | 244 | unsigned long p; |
245 | for (p = start; p < end; p += PAGE_SIZE) { | 245 | for (p = start; p < end; p += PAGE_SIZE) { |
246 | ClearPageReserved(virt_to_page(p)); | 246 | ClearPageReserved(virt_to_page(p)); |
247 | set_page_count(virt_to_page(p), 1); | 247 | init_page_count(virt_to_page(p)); |
248 | free_page(p); | 248 | free_page(p); |
249 | totalram_pages++; | 249 | totalram_pages++; |
250 | } | 250 | } |
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c index c45beb955943..a190e39c907a 100644 --- a/arch/m68k/mm/init.c +++ b/arch/m68k/mm/init.c | |||
@@ -137,7 +137,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
137 | int pages = 0; | 137 | int pages = 0; |
138 | for (; start < end; start += PAGE_SIZE) { | 138 | for (; start < end; start += PAGE_SIZE) { |
139 | ClearPageReserved(virt_to_page(start)); | 139 | ClearPageReserved(virt_to_page(start)); |
140 | set_page_count(virt_to_page(start), 1); | 140 | init_page_count(virt_to_page(start)); |
141 | free_page(start); | 141 | free_page(start); |
142 | totalram_pages++; | 142 | totalram_pages++; |
143 | pages++; | 143 | pages++; |
diff --git a/arch/m68k/mm/memory.c b/arch/m68k/mm/memory.c index 559942ce0e1e..d6d582a5abb0 100644 --- a/arch/m68k/mm/memory.c +++ b/arch/m68k/mm/memory.c | |||
@@ -54,7 +54,7 @@ void __init init_pointer_table(unsigned long ptable) | |||
54 | 54 | ||
55 | /* unreserve the page so it's possible to free that page */ | 55 | /* unreserve the page so it's possible to free that page */ |
56 | PD_PAGE(dp)->flags &= ~(1 << PG_reserved); | 56 | PD_PAGE(dp)->flags &= ~(1 << PG_reserved); |
57 | set_page_count(PD_PAGE(dp), 1); | 57 | init_page_count(PD_PAGE(dp)); |
58 | 58 | ||
59 | return; | 59 | return; |
60 | } | 60 | } |
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c index d855fec26317..afb57eeafdcb 100644 --- a/arch/m68k/mm/motorola.c +++ b/arch/m68k/mm/motorola.c | |||
@@ -276,7 +276,7 @@ void free_initmem(void) | |||
276 | addr = (unsigned long)&__init_begin; | 276 | addr = (unsigned long)&__init_begin; |
277 | for (; addr < (unsigned long)&__init_end; addr += PAGE_SIZE) { | 277 | for (; addr < (unsigned long)&__init_end; addr += PAGE_SIZE) { |
278 | virt_to_page(addr)->flags &= ~(1 << PG_reserved); | 278 | virt_to_page(addr)->flags &= ~(1 << PG_reserved); |
279 | set_page_count(virt_to_page(addr), 1); | 279 | init_page_count(virt_to_page(addr)); |
280 | free_page(addr); | 280 | free_page(addr); |
281 | totalram_pages++; | 281 | totalram_pages++; |
282 | } | 282 | } |
diff --git a/arch/m68knommu/mm/init.c b/arch/m68knommu/mm/init.c index 89f0b554ffb7..d79503fe6e42 100644 --- a/arch/m68knommu/mm/init.c +++ b/arch/m68knommu/mm/init.c | |||
@@ -195,7 +195,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
195 | int pages = 0; | 195 | int pages = 0; |
196 | for (; start < end; start += PAGE_SIZE) { | 196 | for (; start < end; start += PAGE_SIZE) { |
197 | ClearPageReserved(virt_to_page(start)); | 197 | ClearPageReserved(virt_to_page(start)); |
198 | set_page_count(virt_to_page(start), 1); | 198 | init_page_count(virt_to_page(start)); |
199 | free_page(start); | 199 | free_page(start); |
200 | totalram_pages++; | 200 | totalram_pages++; |
201 | pages++; | 201 | pages++; |
@@ -218,7 +218,7 @@ free_initmem() | |||
218 | /* next to check that the page we free is not a partial page */ | 218 | /* next to check that the page we free is not a partial page */ |
219 | for (; addr + PAGE_SIZE < (unsigned long)(&__init_end); addr +=PAGE_SIZE) { | 219 | for (; addr + PAGE_SIZE < (unsigned long)(&__init_end); addr +=PAGE_SIZE) { |
220 | ClearPageReserved(virt_to_page(addr)); | 220 | ClearPageReserved(virt_to_page(addr)); |
221 | set_page_count(virt_to_page(addr), 1); | 221 | init_page_count(virt_to_page(addr)); |
222 | free_page(addr); | 222 | free_page(addr); |
223 | totalram_pages++; | 223 | totalram_pages++; |
224 | } | 224 | } |
diff --git a/arch/mips/arc/memory.c b/arch/mips/arc/memory.c index 958d2eb78862..8a9ef58cc399 100644 --- a/arch/mips/arc/memory.c +++ b/arch/mips/arc/memory.c | |||
@@ -158,7 +158,7 @@ unsigned long __init prom_free_prom_memory(void) | |||
158 | while (addr < boot_mem_map.map[i].addr | 158 | while (addr < boot_mem_map.map[i].addr |
159 | + boot_mem_map.map[i].size) { | 159 | + boot_mem_map.map[i].size) { |
160 | ClearPageReserved(virt_to_page(__va(addr))); | 160 | ClearPageReserved(virt_to_page(__va(addr))); |
161 | set_page_count(virt_to_page(__va(addr)), 1); | 161 | init_page_count(virt_to_page(__va(addr))); |
162 | free_page((unsigned long)__va(addr)); | 162 | free_page((unsigned long)__va(addr)); |
163 | addr += PAGE_SIZE; | 163 | addr += PAGE_SIZE; |
164 | freed += PAGE_SIZE; | 164 | freed += PAGE_SIZE; |
diff --git a/arch/mips/dec/prom/memory.c b/arch/mips/dec/prom/memory.c index 81cb5a76cfb7..1edaf3074ee9 100644 --- a/arch/mips/dec/prom/memory.c +++ b/arch/mips/dec/prom/memory.c | |||
@@ -118,7 +118,7 @@ unsigned long __init prom_free_prom_memory(void) | |||
118 | addr = PAGE_SIZE; | 118 | addr = PAGE_SIZE; |
119 | while (addr < end) { | 119 | while (addr < end) { |
120 | ClearPageReserved(virt_to_page(__va(addr))); | 120 | ClearPageReserved(virt_to_page(__va(addr))); |
121 | set_page_count(virt_to_page(__va(addr)), 1); | 121 | init_page_count(virt_to_page(__va(addr))); |
122 | free_page((unsigned long)__va(addr)); | 122 | free_page((unsigned long)__va(addr)); |
123 | addr += PAGE_SIZE; | 123 | addr += PAGE_SIZE; |
124 | } | 124 | } |
diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c index 2c8afd77a20b..ee5e70c95cf3 100644 --- a/arch/mips/mips-boards/generic/memory.c +++ b/arch/mips/mips-boards/generic/memory.c | |||
@@ -174,7 +174,7 @@ unsigned long __init prom_free_prom_memory(void) | |||
174 | while (addr < boot_mem_map.map[i].addr | 174 | while (addr < boot_mem_map.map[i].addr |
175 | + boot_mem_map.map[i].size) { | 175 | + boot_mem_map.map[i].size) { |
176 | ClearPageReserved(virt_to_page(__va(addr))); | 176 | ClearPageReserved(virt_to_page(__va(addr))); |
177 | set_page_count(virt_to_page(__va(addr)), 1); | 177 | init_page_count(virt_to_page(__va(addr))); |
178 | free_page((unsigned long)__va(addr)); | 178 | free_page((unsigned long)__va(addr)); |
179 | addr += PAGE_SIZE; | 179 | addr += PAGE_SIZE; |
180 | freed += PAGE_SIZE; | 180 | freed += PAGE_SIZE; |
diff --git a/arch/mips/mips-boards/sim/sim_mem.c b/arch/mips/mips-boards/sim/sim_mem.c index 0dbd7435bb2a..1ec4e75656bd 100644 --- a/arch/mips/mips-boards/sim/sim_mem.c +++ b/arch/mips/mips-boards/sim/sim_mem.c | |||
@@ -117,7 +117,7 @@ unsigned long __init prom_free_prom_memory(void) | |||
117 | while (addr < boot_mem_map.map[i].addr | 117 | while (addr < boot_mem_map.map[i].addr |
118 | + boot_mem_map.map[i].size) { | 118 | + boot_mem_map.map[i].size) { |
119 | ClearPageReserved(virt_to_page(__va(addr))); | 119 | ClearPageReserved(virt_to_page(__va(addr))); |
120 | set_page_count(virt_to_page(__va(addr)), 1); | 120 | init_page_count(virt_to_page(__va(addr))); |
121 | free_page((unsigned long)__va(addr)); | 121 | free_page((unsigned long)__va(addr)); |
122 | addr += PAGE_SIZE; | 122 | addr += PAGE_SIZE; |
123 | freed += PAGE_SIZE; | 123 | freed += PAGE_SIZE; |
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index a140da9732db..52f7d59fe612 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -245,7 +245,7 @@ void __init mem_init(void) | |||
245 | #ifdef CONFIG_LIMITED_DMA | 245 | #ifdef CONFIG_LIMITED_DMA |
246 | set_page_address(page, lowmem_page_address(page)); | 246 | set_page_address(page, lowmem_page_address(page)); |
247 | #endif | 247 | #endif |
248 | set_page_count(page, 1); | 248 | init_page_count(page); |
249 | __free_page(page); | 249 | __free_page(page); |
250 | totalhigh_pages++; | 250 | totalhigh_pages++; |
251 | } | 251 | } |
@@ -292,7 +292,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
292 | 292 | ||
293 | for (; start < end; start += PAGE_SIZE) { | 293 | for (; start < end; start += PAGE_SIZE) { |
294 | ClearPageReserved(virt_to_page(start)); | 294 | ClearPageReserved(virt_to_page(start)); |
295 | set_page_count(virt_to_page(start), 1); | 295 | init_page_count(virt_to_page(start)); |
296 | free_page(start); | 296 | free_page(start); |
297 | totalram_pages++; | 297 | totalram_pages++; |
298 | } | 298 | } |
@@ -315,7 +315,7 @@ void free_initmem(void) | |||
315 | page = addr; | 315 | page = addr; |
316 | #endif | 316 | #endif |
317 | ClearPageReserved(virt_to_page(page)); | 317 | ClearPageReserved(virt_to_page(page)); |
318 | set_page_count(virt_to_page(page), 1); | 318 | init_page_count(virt_to_page(page)); |
319 | free_page(page); | 319 | free_page(page); |
320 | totalram_pages++; | 320 | totalram_pages++; |
321 | freed += PAGE_SIZE; | 321 | freed += PAGE_SIZE; |
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c index ed93a9792959..e0d095daa5ed 100644 --- a/arch/mips/sgi-ip27/ip27-memory.c +++ b/arch/mips/sgi-ip27/ip27-memory.c | |||
@@ -559,7 +559,7 @@ void __init mem_init(void) | |||
559 | /* if (!page_is_ram(pgnr)) continue; */ | 559 | /* if (!page_is_ram(pgnr)) continue; */ |
560 | /* commented out until page_is_ram works */ | 560 | /* commented out until page_is_ram works */ |
561 | ClearPageReserved(p); | 561 | ClearPageReserved(p); |
562 | set_page_count(p, 1); | 562 | init_page_count(p); |
563 | __free_page(p); | 563 | __free_page(p); |
564 | totalram_pages++; | 564 | totalram_pages++; |
565 | } | 565 | } |
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index 7847ca13d6c2..852eda3953dc 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c | |||
@@ -398,7 +398,7 @@ void free_initmem(void) | |||
398 | addr = (unsigned long)(&__init_begin); | 398 | addr = (unsigned long)(&__init_begin); |
399 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { | 399 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { |
400 | ClearPageReserved(virt_to_page(addr)); | 400 | ClearPageReserved(virt_to_page(addr)); |
401 | set_page_count(virt_to_page(addr), 1); | 401 | init_page_count(virt_to_page(addr)); |
402 | free_page(addr); | 402 | free_page(addr); |
403 | num_physpages++; | 403 | num_physpages++; |
404 | totalram_pages++; | 404 | totalram_pages++; |
@@ -1018,7 +1018,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
1018 | printk(KERN_INFO "Freeing initrd memory: %ldk freed\n", (end - start) >> 10); | 1018 | printk(KERN_INFO "Freeing initrd memory: %ldk freed\n", (end - start) >> 10); |
1019 | for (; start < end; start += PAGE_SIZE) { | 1019 | for (; start < end; start += PAGE_SIZE) { |
1020 | ClearPageReserved(virt_to_page(start)); | 1020 | ClearPageReserved(virt_to_page(start)); |
1021 | set_page_count(virt_to_page(start), 1); | 1021 | init_page_count(virt_to_page(start)); |
1022 | free_page(start); | 1022 | free_page(start); |
1023 | num_physpages++; | 1023 | num_physpages++; |
1024 | totalram_pages++; | 1024 | totalram_pages++; |
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c index 7d0d75c11848..b57fb3a2b7bb 100644 --- a/arch/powerpc/mm/init_32.c +++ b/arch/powerpc/mm/init_32.c | |||
@@ -216,7 +216,7 @@ static void free_sec(unsigned long start, unsigned long end, const char *name) | |||
216 | 216 | ||
217 | while (start < end) { | 217 | while (start < end) { |
218 | ClearPageReserved(virt_to_page(start)); | 218 | ClearPageReserved(virt_to_page(start)); |
219 | set_page_count(virt_to_page(start), 1); | 219 | init_page_count(virt_to_page(start)); |
220 | free_page(start); | 220 | free_page(start); |
221 | cnt++; | 221 | cnt++; |
222 | start += PAGE_SIZE; | 222 | start += PAGE_SIZE; |
@@ -248,7 +248,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
248 | printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); | 248 | printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); |
249 | for (; start < end; start += PAGE_SIZE) { | 249 | for (; start < end; start += PAGE_SIZE) { |
250 | ClearPageReserved(virt_to_page(start)); | 250 | ClearPageReserved(virt_to_page(start)); |
251 | set_page_count(virt_to_page(start), 1); | 251 | init_page_count(virt_to_page(start)); |
252 | free_page(start); | 252 | free_page(start); |
253 | totalram_pages++; | 253 | totalram_pages++; |
254 | } | 254 | } |
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c index 81cfb0c2ec58..bacb71c89811 100644 --- a/arch/powerpc/mm/init_64.c +++ b/arch/powerpc/mm/init_64.c | |||
@@ -140,7 +140,7 @@ void free_initmem(void) | |||
140 | for (; addr < (unsigned long)__init_end; addr += PAGE_SIZE) { | 140 | for (; addr < (unsigned long)__init_end; addr += PAGE_SIZE) { |
141 | memset((void *)addr, 0xcc, PAGE_SIZE); | 141 | memset((void *)addr, 0xcc, PAGE_SIZE); |
142 | ClearPageReserved(virt_to_page(addr)); | 142 | ClearPageReserved(virt_to_page(addr)); |
143 | set_page_count(virt_to_page(addr), 1); | 143 | init_page_count(virt_to_page(addr)); |
144 | free_page(addr); | 144 | free_page(addr); |
145 | totalram_pages++; | 145 | totalram_pages++; |
146 | } | 146 | } |
@@ -155,7 +155,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
155 | printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); | 155 | printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); |
156 | for (; start < end; start += PAGE_SIZE) { | 156 | for (; start < end; start += PAGE_SIZE) { |
157 | ClearPageReserved(virt_to_page(start)); | 157 | ClearPageReserved(virt_to_page(start)); |
158 | set_page_count(virt_to_page(start), 1); | 158 | init_page_count(virt_to_page(start)); |
159 | free_page(start); | 159 | free_page(start); |
160 | totalram_pages++; | 160 | totalram_pages++; |
161 | } | 161 | } |
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index 6ae5c130d0db..454cac01d8cc 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c | |||
@@ -108,7 +108,7 @@ EXPORT_SYMBOL(phys_mem_access_prot); | |||
108 | void online_page(struct page *page) | 108 | void online_page(struct page *page) |
109 | { | 109 | { |
110 | ClearPageReserved(page); | 110 | ClearPageReserved(page); |
111 | set_page_count(page, 1); | 111 | init_page_count(page); |
112 | __free_page(page); | 112 | __free_page(page); |
113 | totalram_pages++; | 113 | totalram_pages++; |
114 | num_physpages++; | 114 | num_physpages++; |
@@ -376,7 +376,7 @@ void __init mem_init(void) | |||
376 | struct page *page = pfn_to_page(pfn); | 376 | struct page *page = pfn_to_page(pfn); |
377 | 377 | ||
378 | ClearPageReserved(page); | 378 | ClearPageReserved(page); |
379 | set_page_count(page, 1); | 379 | init_page_count(page); |
380 | __free_page(page); | 380 | __free_page(page); |
381 | totalhigh_pages++; | 381 | totalhigh_pages++; |
382 | } | 382 | } |
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c index b33a4443f5a9..fec8e65b36ea 100644 --- a/arch/powerpc/platforms/cell/setup.c +++ b/arch/powerpc/platforms/cell/setup.c | |||
@@ -115,7 +115,7 @@ static void __init cell_spuprop_present(struct device_node *spe, | |||
115 | for (pfn = start_pfn; pfn < end_pfn; pfn++) { | 115 | for (pfn = start_pfn; pfn < end_pfn; pfn++) { |
116 | struct page *page = pfn_to_page(pfn); | 116 | struct page *page = pfn_to_page(pfn); |
117 | set_page_links(page, ZONE_DMA, node_id, pfn); | 117 | set_page_links(page, ZONE_DMA, node_id, pfn); |
118 | set_page_count(page, 1); | 118 | init_page_count(page); |
119 | reset_page_mapcount(page); | 119 | reset_page_mapcount(page); |
120 | SetPageReserved(page); | 120 | SetPageReserved(page); |
121 | INIT_LIST_HEAD(&page->lru); | 121 | INIT_LIST_HEAD(&page->lru); |
diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c index 134db5c04203..cb1c294fb932 100644 --- a/arch/ppc/mm/init.c +++ b/arch/ppc/mm/init.c | |||
@@ -140,7 +140,7 @@ static void free_sec(unsigned long start, unsigned long end, const char *name) | |||
140 | 140 | ||
141 | while (start < end) { | 141 | while (start < end) { |
142 | ClearPageReserved(virt_to_page(start)); | 142 | ClearPageReserved(virt_to_page(start)); |
143 | set_page_count(virt_to_page(start), 1); | 143 | init_page_count(virt_to_page(start)); |
144 | free_page(start); | 144 | free_page(start); |
145 | cnt++; | 145 | cnt++; |
146 | start += PAGE_SIZE; | 146 | start += PAGE_SIZE; |
@@ -172,7 +172,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
172 | 172 | ||
173 | for (; start < end; start += PAGE_SIZE) { | 173 | for (; start < end; start += PAGE_SIZE) { |
174 | ClearPageReserved(virt_to_page(start)); | 174 | ClearPageReserved(virt_to_page(start)); |
175 | set_page_count(virt_to_page(start), 1); | 175 | init_page_count(virt_to_page(start)); |
176 | free_page(start); | 176 | free_page(start); |
177 | totalram_pages++; | 177 | totalram_pages++; |
178 | } | 178 | } |
@@ -441,7 +441,7 @@ void __init mem_init(void) | |||
441 | struct page *page = mem_map + pfn; | 441 | struct page *page = mem_map + pfn; |
442 | 442 | ||
443 | ClearPageReserved(page); | 443 | ClearPageReserved(page); |
444 | set_page_count(page, 1); | 444 | init_page_count(page); |
445 | __free_page(page); | 445 | __free_page(page); |
446 | totalhigh_pages++; | 446 | totalhigh_pages++; |
447 | } | 447 | } |
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index df953383724d..a055894f3bd8 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c | |||
@@ -292,7 +292,7 @@ void free_initmem(void) | |||
292 | addr = (unsigned long)(&__init_begin); | 292 | addr = (unsigned long)(&__init_begin); |
293 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { | 293 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { |
294 | ClearPageReserved(virt_to_page(addr)); | 294 | ClearPageReserved(virt_to_page(addr)); |
295 | set_page_count(virt_to_page(addr), 1); | 295 | init_page_count(virt_to_page(addr)); |
296 | free_page(addr); | 296 | free_page(addr); |
297 | totalram_pages++; | 297 | totalram_pages++; |
298 | } | 298 | } |
@@ -307,7 +307,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
307 | printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); | 307 | printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); |
308 | for (; start < end; start += PAGE_SIZE) { | 308 | for (; start < end; start += PAGE_SIZE) { |
309 | ClearPageReserved(virt_to_page(start)); | 309 | ClearPageReserved(virt_to_page(start)); |
310 | set_page_count(virt_to_page(start), 1); | 310 | init_page_count(virt_to_page(start)); |
311 | free_page(start); | 311 | free_page(start); |
312 | totalram_pages++; | 312 | totalram_pages++; |
313 | } | 313 | } |
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index e342565f75fb..77b4a838fe10 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c | |||
@@ -273,7 +273,7 @@ void free_initmem(void) | |||
273 | addr = (unsigned long)(&__init_begin); | 273 | addr = (unsigned long)(&__init_begin); |
274 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { | 274 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { |
275 | ClearPageReserved(virt_to_page(addr)); | 275 | ClearPageReserved(virt_to_page(addr)); |
276 | set_page_count(virt_to_page(addr), 1); | 276 | init_page_count(virt_to_page(addr)); |
277 | free_page(addr); | 277 | free_page(addr); |
278 | totalram_pages++; | 278 | totalram_pages++; |
279 | } | 279 | } |
@@ -286,7 +286,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
286 | unsigned long p; | 286 | unsigned long p; |
287 | for (p = start; p < end; p += PAGE_SIZE) { | 287 | for (p = start; p < end; p += PAGE_SIZE) { |
288 | ClearPageReserved(virt_to_page(p)); | 288 | ClearPageReserved(virt_to_page(p)); |
289 | set_page_count(virt_to_page(p), 1); | 289 | init_page_count(virt_to_page(p)); |
290 | free_page(p); | 290 | free_page(p); |
291 | totalram_pages++; | 291 | totalram_pages++; |
292 | } | 292 | } |
diff --git a/arch/sh64/mm/init.c b/arch/sh64/mm/init.c index a65e8bb2c3cc..1169757fb38b 100644 --- a/arch/sh64/mm/init.c +++ b/arch/sh64/mm/init.c | |||
@@ -173,7 +173,7 @@ void free_initmem(void) | |||
173 | addr = (unsigned long)(&__init_begin); | 173 | addr = (unsigned long)(&__init_begin); |
174 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { | 174 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { |
175 | ClearPageReserved(virt_to_page(addr)); | 175 | ClearPageReserved(virt_to_page(addr)); |
176 | set_page_count(virt_to_page(addr), 1); | 176 | init_page_count(virt_to_page(addr)); |
177 | free_page(addr); | 177 | free_page(addr); |
178 | totalram_pages++; | 178 | totalram_pages++; |
179 | } | 179 | } |
@@ -186,7 +186,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
186 | unsigned long p; | 186 | unsigned long p; |
187 | for (p = start; p < end; p += PAGE_SIZE) { | 187 | for (p = start; p < end; p += PAGE_SIZE) { |
188 | ClearPageReserved(virt_to_page(p)); | 188 | ClearPageReserved(virt_to_page(p)); |
189 | set_page_count(virt_to_page(p), 1); | 189 | init_page_count(virt_to_page(p)); |
190 | free_page(p); | 190 | free_page(p); |
191 | totalram_pages++; | 191 | totalram_pages++; |
192 | } | 192 | } |
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c index 40d426cce824..4219dd2ce3a2 100644 --- a/arch/sparc/kernel/sun4d_smp.c +++ b/arch/sparc/kernel/sun4d_smp.c | |||
@@ -266,19 +266,19 @@ void __init smp4d_boot_cpus(void) | |||
266 | 266 | ||
267 | /* Free unneeded trap tables */ | 267 | /* Free unneeded trap tables */ |
268 | ClearPageReserved(virt_to_page(trapbase_cpu1)); | 268 | ClearPageReserved(virt_to_page(trapbase_cpu1)); |
269 | set_page_count(virt_to_page(trapbase_cpu1), 1); | 269 | init_page_count(virt_to_page(trapbase_cpu1)); |
270 | free_page((unsigned long)trapbase_cpu1); | 270 | free_page((unsigned long)trapbase_cpu1); |
271 | totalram_pages++; | 271 | totalram_pages++; |
272 | num_physpages++; | 272 | num_physpages++; |
273 | 273 | ||
274 | ClearPageReserved(virt_to_page(trapbase_cpu2)); | 274 | ClearPageReserved(virt_to_page(trapbase_cpu2)); |
275 | set_page_count(virt_to_page(trapbase_cpu2), 1); | 275 | init_page_count(virt_to_page(trapbase_cpu2)); |
276 | free_page((unsigned long)trapbase_cpu2); | 276 | free_page((unsigned long)trapbase_cpu2); |
277 | totalram_pages++; | 277 | totalram_pages++; |
278 | num_physpages++; | 278 | num_physpages++; |
279 | 279 | ||
280 | ClearPageReserved(virt_to_page(trapbase_cpu3)); | 280 | ClearPageReserved(virt_to_page(trapbase_cpu3)); |
281 | set_page_count(virt_to_page(trapbase_cpu3), 1); | 281 | init_page_count(virt_to_page(trapbase_cpu3)); |
282 | free_page((unsigned long)trapbase_cpu3); | 282 | free_page((unsigned long)trapbase_cpu3); |
283 | totalram_pages++; | 283 | totalram_pages++; |
284 | num_physpages++; | 284 | num_physpages++; |
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c index a21f27d10e55..fbbd8a474c4c 100644 --- a/arch/sparc/kernel/sun4m_smp.c +++ b/arch/sparc/kernel/sun4m_smp.c | |||
@@ -233,21 +233,21 @@ void __init smp4m_boot_cpus(void) | |||
233 | /* Free unneeded trap tables */ | 233 | /* Free unneeded trap tables */ |
234 | if (!cpu_isset(i, cpu_present_map)) { | 234 | if (!cpu_isset(i, cpu_present_map)) { |
235 | ClearPageReserved(virt_to_page(trapbase_cpu1)); | 235 | ClearPageReserved(virt_to_page(trapbase_cpu1)); |
236 | set_page_count(virt_to_page(trapbase_cpu1), 1); | 236 | init_page_count(virt_to_page(trapbase_cpu1)); |
237 | free_page((unsigned long)trapbase_cpu1); | 237 | free_page((unsigned long)trapbase_cpu1); |
238 | totalram_pages++; | 238 | totalram_pages++; |
239 | num_physpages++; | 239 | num_physpages++; |
240 | } | 240 | } |
241 | if (!cpu_isset(2, cpu_present_map)) { | 241 | if (!cpu_isset(2, cpu_present_map)) { |
242 | ClearPageReserved(virt_to_page(trapbase_cpu2)); | 242 | ClearPageReserved(virt_to_page(trapbase_cpu2)); |
243 | set_page_count(virt_to_page(trapbase_cpu2), 1); | 243 | init_page_count(virt_to_page(trapbase_cpu2)); |
244 | free_page((unsigned long)trapbase_cpu2); | 244 | free_page((unsigned long)trapbase_cpu2); |
245 | totalram_pages++; | 245 | totalram_pages++; |
246 | num_physpages++; | 246 | num_physpages++; |
247 | } | 247 | } |
248 | if (!cpu_isset(3, cpu_present_map)) { | 248 | if (!cpu_isset(3, cpu_present_map)) { |
249 | ClearPageReserved(virt_to_page(trapbase_cpu3)); | 249 | ClearPageReserved(virt_to_page(trapbase_cpu3)); |
250 | set_page_count(virt_to_page(trapbase_cpu3), 1); | 250 | init_page_count(virt_to_page(trapbase_cpu3)); |
251 | free_page((unsigned long)trapbase_cpu3); | 251 | free_page((unsigned long)trapbase_cpu3); |
252 | totalram_pages++; | 252 | totalram_pages++; |
253 | num_physpages++; | 253 | num_physpages++; |
diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init.c index c03babaa0498..898669732466 100644 --- a/arch/sparc/mm/init.c +++ b/arch/sparc/mm/init.c | |||
@@ -383,7 +383,7 @@ void map_high_region(unsigned long start_pfn, unsigned long end_pfn) | |||
383 | struct page *page = pfn_to_page(tmp); | 383 | struct page *page = pfn_to_page(tmp); |
384 | 384 | ||
385 | ClearPageReserved(page); | 385 | ClearPageReserved(page); |
386 | set_page_count(page, 1); | 386 | init_page_count(page); |
387 | __free_page(page); | 387 | __free_page(page); |
388 | totalhigh_pages++; | 388 | totalhigh_pages++; |
389 | } | 389 | } |
@@ -480,7 +480,7 @@ void free_initmem (void) | |||
480 | p = virt_to_page(addr); | 480 | p = virt_to_page(addr); |
481 | 481 | ||
482 | ClearPageReserved(p); | 482 | ClearPageReserved(p); |
483 | set_page_count(p, 1); | 483 | init_page_count(p); |
484 | __free_page(p); | 484 | __free_page(p); |
485 | totalram_pages++; | 485 | totalram_pages++; |
486 | num_physpages++; | 486 | num_physpages++; |
@@ -497,7 +497,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
497 | struct page *p = virt_to_page(start); | 497 | struct page *p = virt_to_page(start); |
498 | 498 | ||
499 | ClearPageReserved(p); | 499 | ClearPageReserved(p); |
500 | set_page_count(p, 1); | 500 | init_page_count(p); |
501 | __free_page(p); | 501 | __free_page(p); |
502 | num_physpages++; | 502 | num_physpages++; |
503 | } | 503 | } |
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index c2b556106fc1..2ae143ba50d8 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c | |||
@@ -1461,7 +1461,7 @@ void free_initmem(void) | |||
1461 | p = virt_to_page(page); | 1461 | p = virt_to_page(page); |
1462 | 1462 | ||
1463 | ClearPageReserved(p); | 1463 | ClearPageReserved(p); |
1464 | set_page_count(p, 1); | 1464 | init_page_count(p); |
1465 | __free_page(p); | 1465 | __free_page(p); |
1466 | num_physpages++; | 1466 | num_physpages++; |
1467 | totalram_pages++; | 1467 | totalram_pages++; |
@@ -1477,7 +1477,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
1477 | struct page *p = virt_to_page(start); | 1477 | struct page *p = virt_to_page(start); |
1478 | 1478 | ||
1479 | ClearPageReserved(p); | 1479 | ClearPageReserved(p); |
1480 | set_page_count(p, 1); | 1480 | init_page_count(p); |
1481 | __free_page(p); | 1481 | __free_page(p); |
1482 | num_physpages++; | 1482 | num_physpages++; |
1483 | totalram_pages++; | 1483 | totalram_pages++; |
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c index fa4f915be5c5..92cce96b5e24 100644 --- a/arch/um/kernel/mem.c +++ b/arch/um/kernel/mem.c | |||
@@ -57,7 +57,7 @@ static void setup_highmem(unsigned long highmem_start, | |||
57 | for(i = 0; i < highmem_len >> PAGE_SHIFT; i++){ | 57 | for(i = 0; i < highmem_len >> PAGE_SHIFT; i++){ |
58 | page = &mem_map[highmem_pfn + i]; | 58 | page = &mem_map[highmem_pfn + i]; |
59 | ClearPageReserved(page); | 59 | ClearPageReserved(page); |
60 | set_page_count(page, 1); | 60 | init_page_count(page); |
61 | __free_page(page); | 61 | __free_page(page); |
62 | } | 62 | } |
63 | } | 63 | } |
@@ -296,7 +296,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
296 | (end - start) >> 10); | 296 | (end - start) >> 10); |
297 | for (; start < end; start += PAGE_SIZE) { | 297 | for (; start < end; start += PAGE_SIZE) { |
298 | ClearPageReserved(virt_to_page(start)); | 298 | ClearPageReserved(virt_to_page(start)); |
299 | set_page_count(virt_to_page(start), 1); | 299 | init_page_count(virt_to_page(start)); |
300 | free_page(start); | 300 | free_page(start); |
301 | totalram_pages++; | 301 | totalram_pages++; |
302 | } | 302 | } |
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c index 7af1742aa958..40ed13d263cd 100644 --- a/arch/x86_64/mm/init.c +++ b/arch/x86_64/mm/init.c | |||
@@ -486,7 +486,7 @@ void __init clear_kernel_mapping(unsigned long address, unsigned long size) | |||
486 | void online_page(struct page *page) | 486 | void online_page(struct page *page) |
487 | { | 487 | { |
488 | ClearPageReserved(page); | 488 | ClearPageReserved(page); |
489 | set_page_count(page, 1); | 489 | init_page_count(page); |
490 | __free_page(page); | 490 | __free_page(page); |
491 | totalram_pages++; | 491 | totalram_pages++; |
492 | num_physpages++; | 492 | num_physpages++; |
@@ -592,7 +592,7 @@ void free_initmem(void) | |||
592 | addr = (unsigned long)(&__init_begin); | 592 | addr = (unsigned long)(&__init_begin); |
593 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { | 593 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { |
594 | ClearPageReserved(virt_to_page(addr)); | 594 | ClearPageReserved(virt_to_page(addr)); |
595 | set_page_count(virt_to_page(addr), 1); | 595 | init_page_count(virt_to_page(addr)); |
596 | memset((void *)(addr & ~(PAGE_SIZE-1)), 0xcc, PAGE_SIZE); | 596 | memset((void *)(addr & ~(PAGE_SIZE-1)), 0xcc, PAGE_SIZE); |
597 | free_page(addr); | 597 | free_page(addr); |
598 | totalram_pages++; | 598 | totalram_pages++; |
@@ -632,7 +632,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
632 | printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); | 632 | printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); |
633 | for (; start < end; start += PAGE_SIZE) { | 633 | for (; start < end; start += PAGE_SIZE) { |
634 | ClearPageReserved(virt_to_page(start)); | 634 | ClearPageReserved(virt_to_page(start)); |
635 | set_page_count(virt_to_page(start), 1); | 635 | init_page_count(virt_to_page(start)); |
636 | free_page(start); | 636 | free_page(start); |
637 | totalram_pages++; | 637 | totalram_pages++; |
638 | } | 638 | } |
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c index 5a91d6c9e66d..e1be4235f367 100644 --- a/arch/xtensa/mm/init.c +++ b/arch/xtensa/mm/init.c | |||
@@ -272,7 +272,7 @@ free_reserved_mem(void *start, void *end) | |||
272 | { | 272 | { |
273 | for (; start < end; start += PAGE_SIZE) { | 273 | for (; start < end; start += PAGE_SIZE) { |
274 | ClearPageReserved(virt_to_page(start)); | 274 | ClearPageReserved(virt_to_page(start)); |
275 | set_page_count(virt_to_page(start), 1); | 275 | init_page_count(virt_to_page(start)); |
276 | free_page((unsigned long)start); | 276 | free_page((unsigned long)start); |
277 | totalram_pages++; | 277 | totalram_pages++; |
278 | } | 278 | } |
diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index b058273527bb..76448d6ae896 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c | |||
@@ -1269,7 +1269,7 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) | |||
1269 | */ | 1269 | */ |
1270 | page = virt_to_page(virtual_start); | 1270 | page = virt_to_page(virtual_start); |
1271 | ClearPageReserved(page); | 1271 | ClearPageReserved(page); |
1272 | set_page_count(page, 1); | 1272 | init_page_count(page); |
1273 | free_page(virtual_start); | 1273 | free_page(virtual_start); |
1274 | 1274 | ||
1275 | virtual_start += PAGE_SIZE; | 1275 | virtual_start += PAGE_SIZE; |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 3d84b7a35e0d..7d8c127daad7 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -307,8 +307,6 @@ static inline int get_page_unless_zero(struct page *page) | |||
307 | return atomic_inc_not_zero(&page->_count); | 307 | return atomic_inc_not_zero(&page->_count); |
308 | } | 308 | } |
309 | 309 | ||
310 | #define set_page_count(p,v) atomic_set(&(p)->_count, (v)) | ||
311 | |||
312 | extern void FASTCALL(__page_cache_release(struct page *)); | 310 | extern void FASTCALL(__page_cache_release(struct page *)); |
313 | 311 | ||
314 | static inline int page_count(struct page *page) | 312 | static inline int page_count(struct page *page) |
@@ -325,6 +323,15 @@ static inline void get_page(struct page *page) | |||
325 | atomic_inc(&page->_count); | 323 | atomic_inc(&page->_count); |
326 | } | 324 | } |
327 | 325 | ||
326 | /* | ||
327 | * Setup the page count before being freed into the page allocator for | ||
328 | * the first time (boot or memory hotplug) | ||
329 | */ | ||
330 | static inline void init_page_count(struct page *page) | ||
331 | { | ||
332 | atomic_set(&page->_count, 1); | ||
333 | } | ||
334 | |||
328 | void put_page(struct page *page); | 335 | void put_page(struct page *page); |
329 | 336 | ||
330 | void split_page(struct page *page, unsigned int order); | 337 | void split_page(struct page *page, unsigned int order); |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 39d49ecea8e8..20117a4b8ab6 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/pgtable.h> | 18 | #include <asm/pgtable.h> |
19 | 19 | ||
20 | #include <linux/hugetlb.h> | 20 | #include <linux/hugetlb.h> |
21 | #include "internal.h" | ||
21 | 22 | ||
22 | const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL; | 23 | const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL; |
23 | static unsigned long nr_huge_pages, free_huge_pages; | 24 | static unsigned long nr_huge_pages, free_huge_pages; |
@@ -106,7 +107,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, unsigned long addr) | |||
106 | return NULL; | 107 | return NULL; |
107 | } | 108 | } |
108 | spin_unlock(&hugetlb_lock); | 109 | spin_unlock(&hugetlb_lock); |
109 | set_page_count(page, 1); | 110 | set_page_refcounted(page); |
110 | for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i) | 111 | for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i) |
111 | clear_user_highpage(&page[i], addr); | 112 | clear_user_highpage(&page[i], addr); |
112 | return page; | 113 | return page; |
@@ -152,7 +153,7 @@ static void update_and_free_page(struct page *page) | |||
152 | 1 << PG_private | 1<< PG_writeback); | 153 | 1 << PG_private | 1<< PG_writeback); |
153 | } | 154 | } |
154 | page[1].lru.next = NULL; | 155 | page[1].lru.next = NULL; |
155 | set_page_count(page, 1); | 156 | set_page_refcounted(page); |
156 | __free_pages(page, HUGETLB_PAGE_ORDER); | 157 | __free_pages(page, HUGETLB_PAGE_ORDER); |
157 | } | 158 | } |
158 | 159 | ||
diff --git a/mm/internal.h b/mm/internal.h index 7bb339779818..d20e3cc4aef0 100644 --- a/mm/internal.h +++ b/mm/internal.h | |||
@@ -13,8 +13,19 @@ | |||
13 | 13 | ||
14 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
15 | 15 | ||
16 | static inline void set_page_refs(struct page *page, int order) | 16 | static inline void set_page_count(struct page *page, int v) |
17 | { | 17 | { |
18 | atomic_set(&page->_count, v); | ||
19 | } | ||
20 | |||
21 | /* | ||
22 | * Turn a non-refcounted page (->_count == 0) into refcounted with | ||
23 | * a count of one. | ||
24 | */ | ||
25 | static inline void set_page_refcounted(struct page *page) | ||
26 | { | ||
27 | BUG_ON(PageCompound(page) && page_private(page) != (unsigned long)page); | ||
28 | BUG_ON(atomic_read(&page->_count)); | ||
18 | set_page_count(page, 1); | 29 | set_page_count(page, 1); |
19 | } | 30 | } |
20 | 31 | ||
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e197818a7cf6..7f65b5a63bb3 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -442,7 +442,7 @@ void fastcall __init __free_pages_bootmem(struct page *page, unsigned int order) | |||
442 | if (order == 0) { | 442 | if (order == 0) { |
443 | __ClearPageReserved(page); | 443 | __ClearPageReserved(page); |
444 | set_page_count(page, 0); | 444 | set_page_count(page, 0); |
445 | set_page_refs(page, 0); | 445 | set_page_refcounted(page); |
446 | __free_page(page); | 446 | __free_page(page); |
447 | } else { | 447 | } else { |
448 | int loop; | 448 | int loop; |
@@ -457,7 +457,7 @@ void fastcall __init __free_pages_bootmem(struct page *page, unsigned int order) | |||
457 | set_page_count(p, 0); | 457 | set_page_count(p, 0); |
458 | } | 458 | } |
459 | 459 | ||
460 | set_page_refs(page, order); | 460 | set_page_refcounted(page); |
461 | __free_pages(page, order); | 461 | __free_pages(page, order); |
462 | } | 462 | } |
463 | } | 463 | } |
@@ -525,7 +525,7 @@ static int prep_new_page(struct page *page, int order) | |||
525 | 1 << PG_referenced | 1 << PG_arch_1 | | 525 | 1 << PG_referenced | 1 << PG_arch_1 | |
526 | 1 << PG_checked | 1 << PG_mappedtodisk); | 526 | 1 << PG_checked | 1 << PG_mappedtodisk); |
527 | set_page_private(page, 0); | 527 | set_page_private(page, 0); |
528 | set_page_refs(page, order); | 528 | set_page_refcounted(page); |
529 | kernel_map_pages(page, 1 << order, 1); | 529 | kernel_map_pages(page, 1 << order, 1); |
530 | return 0; | 530 | return 0; |
531 | } | 531 | } |
@@ -755,10 +755,8 @@ void split_page(struct page *page, unsigned int order) | |||
755 | 755 | ||
756 | BUG_ON(PageCompound(page)); | 756 | BUG_ON(PageCompound(page)); |
757 | BUG_ON(!page_count(page)); | 757 | BUG_ON(!page_count(page)); |
758 | for (i = 1; i < (1 << order); i++) { | 758 | for (i = 1; i < (1 << order); i++) |
759 | BUG_ON(page_count(page + i)); | 759 | set_page_refcounted(page + i); |
760 | set_page_count(page + i, 1); | ||
761 | } | ||
762 | } | 760 | } |
763 | 761 | ||
764 | /* | 762 | /* |
@@ -1771,7 +1769,7 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, | |||
1771 | continue; | 1769 | continue; |
1772 | page = pfn_to_page(pfn); | 1770 | page = pfn_to_page(pfn); |
1773 | set_page_links(page, zone, nid, pfn); | 1771 | set_page_links(page, zone, nid, pfn); |
1774 | set_page_count(page, 1); | 1772 | init_page_count(page); |
1775 | reset_page_mapcount(page); | 1773 | reset_page_mapcount(page); |
1776 | SetPageReserved(page); | 1774 | SetPageReserved(page); |
1777 | INIT_LIST_HEAD(&page->lru); | 1775 | INIT_LIST_HEAD(&page->lru); |