aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2006-09-26 02:31:11 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-26 11:48:46 -0400
commitc1f60a5a419cc60aff27daffb150f5a3a3a79ef4 (patch)
tree8ae176462d6f220cd744ae6c3454113eebda02a8
parent182e8e237349e7b6354f45aee4780b6423fd6a50 (diff)
[PATCH] reduce MAX_NR_ZONES: move HIGHMEM counters into highmem.c/.h
Move totalhigh_pages and nr_free_highpages() into highmem.c/.h Move the totalhigh_pages definition into highmem.c/.h. Move the nr_free_highpages function into highmem.c [yoichi_yuasa@tripeaks.co.jp: build fix] Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/mips/sgi-ip27/ip27-memory.c1
-rw-r--r--arch/um/kernel/mem.c2
-rw-r--r--include/linux/highmem.h3
-rw-r--r--include/linux/swap.h1
-rw-r--r--mm/highmem.c13
-rw-r--r--mm/page_alloc.c15
-rw-r--r--mm/shmem.c1
7 files changed, 20 insertions, 16 deletions
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index 59bfc0fc3f45..16e5682b01f1 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -19,6 +19,7 @@
19#include <linux/swap.h> 19#include <linux/swap.h>
20#include <linux/bootmem.h> 20#include <linux/bootmem.h>
21#include <linux/pfn.h> 21#include <linux/pfn.h>
22#include <linux/highmem.h>
22#include <asm/page.h> 23#include <asm/page.h>
23#include <asm/sections.h> 24#include <asm/sections.h>
24 25
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 61280167c560..b39e624c3291 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -79,8 +79,10 @@ void mem_init(void)
79 79
80 /* this will put all low memory onto the freelists */ 80 /* this will put all low memory onto the freelists */
81 totalram_pages = free_all_bootmem(); 81 totalram_pages = free_all_bootmem();
82#ifdef CONFIG_HIGHMEM
82 totalhigh_pages = highmem >> PAGE_SHIFT; 83 totalhigh_pages = highmem >> PAGE_SHIFT;
83 totalram_pages += totalhigh_pages; 84 totalram_pages += totalhigh_pages;
85#endif
84 num_physpages = totalram_pages; 86 num_physpages = totalram_pages;
85 max_pfn = totalram_pages; 87 max_pfn = totalram_pages;
86 printk(KERN_INFO "Memory: %luk available\n", 88 printk(KERN_INFO "Memory: %luk available\n",
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 42620e723abb..fd7d12daa94f 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -24,11 +24,14 @@ static inline void flush_kernel_dcache_page(struct page *page)
24 24
25/* declarations for linux/mm/highmem.c */ 25/* declarations for linux/mm/highmem.c */
26unsigned int nr_free_highpages(void); 26unsigned int nr_free_highpages(void);
27extern unsigned long totalhigh_pages;
27 28
28#else /* CONFIG_HIGHMEM */ 29#else /* CONFIG_HIGHMEM */
29 30
30static inline unsigned int nr_free_highpages(void) { return 0; } 31static inline unsigned int nr_free_highpages(void) { return 0; }
31 32
33#define totalhigh_pages 0
34
32#ifndef ARCH_HAS_KMAP 35#ifndef ARCH_HAS_KMAP
33static inline void *kmap(struct page *page) 36static inline void *kmap(struct page *page)
34{ 37{
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 5e59184c9096..34a6bc3e6cf3 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -162,7 +162,6 @@ extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *
162 162
163/* linux/mm/page_alloc.c */ 163/* linux/mm/page_alloc.c */
164extern unsigned long totalram_pages; 164extern unsigned long totalram_pages;
165extern unsigned long totalhigh_pages;
166extern unsigned long totalreserve_pages; 165extern unsigned long totalreserve_pages;
167extern long nr_swap_pages; 166extern long nr_swap_pages;
168extern unsigned int nr_free_pages(void); 167extern unsigned int nr_free_pages(void);
diff --git a/mm/highmem.c b/mm/highmem.c
index 9b2a5403c447..ee5519b176ee 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -46,6 +46,19 @@ static void *mempool_alloc_pages_isa(gfp_t gfp_mask, void *data)
46 */ 46 */
47#ifdef CONFIG_HIGHMEM 47#ifdef CONFIG_HIGHMEM
48 48
49unsigned long totalhigh_pages __read_mostly;
50
51unsigned int nr_free_highpages (void)
52{
53 pg_data_t *pgdat;
54 unsigned int pages = 0;
55
56 for_each_online_pgdat(pgdat)
57 pages += pgdat->node_zones[ZONE_HIGHMEM].free_pages;
58
59 return pages;
60}
61
49static int pkmap_count[LAST_PKMAP]; 62static int pkmap_count[LAST_PKMAP];
50static unsigned int last_pkmap_nr; 63static unsigned int last_pkmap_nr;
51static __cacheline_aligned_in_smp DEFINE_SPINLOCK(kmap_lock); 64static __cacheline_aligned_in_smp DEFINE_SPINLOCK(kmap_lock);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e26491cb5a27..5cde54695cfb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -51,7 +51,6 @@ EXPORT_SYMBOL(node_online_map);
51nodemask_t node_possible_map __read_mostly = NODE_MASK_ALL; 51nodemask_t node_possible_map __read_mostly = NODE_MASK_ALL;
52EXPORT_SYMBOL(node_possible_map); 52EXPORT_SYMBOL(node_possible_map);
53unsigned long totalram_pages __read_mostly; 53unsigned long totalram_pages __read_mostly;
54unsigned long totalhigh_pages __read_mostly;
55unsigned long totalreserve_pages __read_mostly; 54unsigned long totalreserve_pages __read_mostly;
56long nr_swap_pages; 55long nr_swap_pages;
57int percpu_pagelist_fraction; 56int percpu_pagelist_fraction;
@@ -1185,20 +1184,6 @@ unsigned int nr_free_pagecache_pages(void)
1185{ 1184{
1186 return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER)); 1185 return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER));
1187} 1186}
1188
1189#ifdef CONFIG_HIGHMEM
1190unsigned int nr_free_highpages (void)
1191{
1192 pg_data_t *pgdat;
1193 unsigned int pages = 0;
1194
1195 for_each_online_pgdat(pgdat)
1196 pages += pgdat->node_zones[ZONE_HIGHMEM].free_pages;
1197
1198 return pages;
1199}
1200#endif
1201
1202#ifdef CONFIG_NUMA 1187#ifdef CONFIG_NUMA
1203static void show_node(struct zone *zone) 1188static void show_node(struct zone *zone)
1204{ 1189{
diff --git a/mm/shmem.c b/mm/shmem.c
index db21c51531ca..8631be45b40d 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -45,6 +45,7 @@
45#include <linux/namei.h> 45#include <linux/namei.h>
46#include <linux/ctype.h> 46#include <linux/ctype.h>
47#include <linux/migrate.h> 47#include <linux/migrate.h>
48#include <linux/highmem.h>
48 49
49#include <asm/uaccess.h> 50#include <asm/uaccess.h>
50#include <asm/div64.h> 51#include <asm/div64.h>