Commit c1f60a5a419cc60aff27daffb150f5a3a3a79ef4

Authored by Christoph Lameter
Committed by Linus Torvalds
1 parent 182e8e2373

[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>

Showing 7 changed files with 20 additions and 16 deletions Side-by-side Diff

arch/mips/sgi-ip27/ip27-memory.c
... ... @@ -19,6 +19,7 @@
19 19 #include <linux/swap.h>
20 20 #include <linux/bootmem.h>
21 21 #include <linux/pfn.h>
  22 +#include <linux/highmem.h>
22 23 #include <asm/page.h>
23 24 #include <asm/sections.h>
24 25  
arch/um/kernel/mem.c
... ... @@ -79,8 +79,10 @@
79 79  
80 80 /* this will put all low memory onto the freelists */
81 81 totalram_pages = free_all_bootmem();
  82 +#ifdef CONFIG_HIGHMEM
82 83 totalhigh_pages = highmem >> PAGE_SHIFT;
83 84 totalram_pages += totalhigh_pages;
  85 +#endif
84 86 num_physpages = totalram_pages;
85 87 max_pfn = totalram_pages;
86 88 printk(KERN_INFO "Memory: %luk available\n",
include/linux/highmem.h
... ... @@ -24,10 +24,13 @@
24 24  
25 25 /* declarations for linux/mm/highmem.c */
26 26 unsigned int nr_free_highpages(void);
  27 +extern unsigned long totalhigh_pages;
27 28  
28 29 #else /* CONFIG_HIGHMEM */
29 30  
30 31 static inline unsigned int nr_free_highpages(void) { return 0; }
  32 +
  33 +#define totalhigh_pages 0
31 34  
32 35 #ifndef ARCH_HAS_KMAP
33 36 static inline void *kmap(struct page *page)
include/linux/swap.h
... ... @@ -162,7 +162,6 @@
162 162  
163 163 /* linux/mm/page_alloc.c */
164 164 extern unsigned long totalram_pages;
165   -extern unsigned long totalhigh_pages;
166 165 extern unsigned long totalreserve_pages;
167 166 extern long nr_swap_pages;
168 167 extern unsigned int nr_free_pages(void);
... ... @@ -46,6 +46,19 @@
46 46 */
47 47 #ifdef CONFIG_HIGHMEM
48 48  
  49 +unsigned long totalhigh_pages __read_mostly;
  50 +
  51 +unsigned 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 +
49 62 static int pkmap_count[LAST_PKMAP];
50 63 static unsigned int last_pkmap_nr;
51 64 static __cacheline_aligned_in_smp DEFINE_SPINLOCK(kmap_lock);
... ... @@ -51,7 +51,6 @@
51 51 nodemask_t node_possible_map __read_mostly = NODE_MASK_ALL;
52 52 EXPORT_SYMBOL(node_possible_map);
53 53 unsigned long totalram_pages __read_mostly;
54   -unsigned long totalhigh_pages __read_mostly;
55 54 unsigned long totalreserve_pages __read_mostly;
56 55 long nr_swap_pages;
57 56 int percpu_pagelist_fraction;
... ... @@ -1185,20 +1184,6 @@
1185 1184 {
1186 1185 return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER));
1187 1186 }
1188   -
1189   -#ifdef CONFIG_HIGHMEM
1190   -unsigned 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 1187 #ifdef CONFIG_NUMA
1203 1188 static void show_node(struct zone *zone)
1204 1189 {
... ... @@ -45,6 +45,7 @@
45 45 #include <linux/namei.h>
46 46 #include <linux/ctype.h>
47 47 #include <linux/migrate.h>
  48 +#include <linux/highmem.h>
48 49  
49 50 #include <asm/uaccess.h>
50 51 #include <asm/div64.h>