Blame view

include/linux/bootmem.h 5.1 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
  /*
   * Discontiguous memory support, Kanoj Sarcar, SGI, Nov 1999
   */
  #ifndef _LINUX_BOOTMEM_H
  #define _LINUX_BOOTMEM_H
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
  #include <linux/mmzone.h>
e786e86a5   Franck Bui-Huu   [PATCH] bootmem: ...
7
  #include <asm/dma.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
8
9
10
11
12
13
14
15
16
17
18
19
  
  /*
   *  simple boot-time physical memory area allocator.
   */
  
  extern unsigned long max_low_pfn;
  extern unsigned long min_low_pfn;
  
  /*
   * highest page
   */
  extern unsigned long max_pfn;
92aa63a5a   Vivek Goyal   [PATCH] kdump: Re...
20
21
22
  #ifdef CONFIG_CRASH_DUMP
  extern unsigned long saved_max_pfn;
  #endif
08677214e   Yinghai Lu   x86: Make 64 bit ...
23
  #ifndef CONFIG_NO_BOOTMEM
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
24
25
26
27
28
  /*
   * node_bootmem_map is a map pointer - the bits represent all physical 
   * memory pages (including holes) on the node.
   */
  typedef struct bootmem_data {
3560e249a   Johannes Weiner   bootmem: replace ...
29
  	unsigned long node_min_pfn;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
30
31
  	unsigned long node_low_pfn;
  	void *node_bootmem_map;
5f2809e69   Johannes Weiner   bootmem: clean up...
32
33
  	unsigned long last_end_off;
  	unsigned long hint_idx;
679bc9fbb   KAMEZAWA Hiroyuki   [PATCH] for_each_...
34
  	struct list_head list;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
35
  } bootmem_data_t;
b61bfa3c4   Johannes Weiner   mm: move bootmem ...
36
  extern bootmem_data_t bootmem_node_data[];
08677214e   Yinghai Lu   x86: Make 64 bit ...
37
  #endif
b61bfa3c4   Johannes Weiner   mm: move bootmem ...
38

f71bf0cac   Franck Bui-Huu   [PATCH] bootmem: ...
39
  extern unsigned long bootmem_bootmap_pages(unsigned long);
223e8dc92   Johannes Weiner   bootmem: reorder ...
40
41
42
43
44
  
  extern unsigned long init_bootmem_node(pg_data_t *pgdat,
  				       unsigned long freepfn,
  				       unsigned long startpfn,
  				       unsigned long endpfn);
f71bf0cac   Franck Bui-Huu   [PATCH] bootmem: ...
45
  extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
223e8dc92   Johannes Weiner   bootmem: reorder ...
46

08677214e   Yinghai Lu   x86: Make 64 bit ...
47
  unsigned long free_all_memory_core_early(int nodeid);
223e8dc92   Johannes Weiner   bootmem: reorder ...
48
49
50
51
52
53
  extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
  extern unsigned long free_all_bootmem(void);
  
  extern void free_bootmem_node(pg_data_t *pgdat,
  			      unsigned long addr,
  			      unsigned long size);
f71bf0cac   Franck Bui-Huu   [PATCH] bootmem: ...
54
  extern void free_bootmem(unsigned long addr, unsigned long size);
9f993ac3f   FUJITA Tomonori   bootmem: Add free...
55
  extern void free_bootmem_late(unsigned long addr, unsigned long size);
223e8dc92   Johannes Weiner   bootmem: reorder ...
56
57
58
59
60
61
62
63
64
65
66
  
  /*
   * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE,
   * the architecture-specific code should honor this).
   *
   * If flags is 0, then the return value is always 0 (success). If
   * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the
   * memory already was reserved.
   */
  #define BOOTMEM_DEFAULT		0
  #define BOOTMEM_EXCLUSIVE	(1<<0)
c13293755   Tejun Heo   bootmem: clean up...
67
68
69
  extern int reserve_bootmem(unsigned long addr,
  			   unsigned long size,
  			   int flags);
2d0aae416   Tejun Heo   bootmem: reorder ...
70
71
72
73
74
75
  extern int reserve_bootmem_node(pg_data_t *pgdat,
  				unsigned long physaddr,
  				unsigned long size,
  				int flags);
  
  extern void *__alloc_bootmem(unsigned long size,
f71bf0cac   Franck Bui-Huu   [PATCH] bootmem: ...
76
77
  			     unsigned long align,
  			     unsigned long goal);
2d0aae416   Tejun Heo   bootmem: reorder ...
78
  extern void *__alloc_bootmem_nopanic(unsigned long size,
f71bf0cac   Franck Bui-Huu   [PATCH] bootmem: ...
79
80
  				     unsigned long align,
  				     unsigned long goal);
223e8dc92   Johannes Weiner   bootmem: reorder ...
81
82
83
84
  extern void *__alloc_bootmem_node(pg_data_t *pgdat,
  				  unsigned long size,
  				  unsigned long align,
  				  unsigned long goal);
08677214e   Yinghai Lu   x86: Make 64 bit ...
85
86
87
88
  void *__alloc_bootmem_node_high(pg_data_t *pgdat,
  				  unsigned long size,
  				  unsigned long align,
  				  unsigned long goal);
223e8dc92   Johannes Weiner   bootmem: reorder ...
89
90
91
92
  extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat,
  				  unsigned long size,
  				  unsigned long align,
  				  unsigned long goal);
2d0aae416   Tejun Heo   bootmem: reorder ...
93
94
95
  extern void *__alloc_bootmem_low(unsigned long size,
  				 unsigned long align,
  				 unsigned long goal);
f71bf0cac   Franck Bui-Huu   [PATCH] bootmem: ...
96
97
98
99
  extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
  				      unsigned long size,
  				      unsigned long align,
  				      unsigned long goal);
c13293755   Tejun Heo   bootmem: clean up...
100

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
101
  #define alloc_bootmem(x) \
71fb2e8f8   Franck Bui-Huu   [PATCH] bootmem: ...
102
  	__alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
53dde5f38   Suresh Siddha   bootmem: Add allo...
103
104
  #define alloc_bootmem_align(x, align) \
  	__alloc_bootmem(x, align, __pa(MAX_DMA_ADDRESS))
74768ed83   Jan Beulich   page allocator: u...
105
106
  #define alloc_bootmem_nopanic(x) \
  	__alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
107
  #define alloc_bootmem_pages(x) \
71fb2e8f8   Franck Bui-Huu   [PATCH] bootmem: ...
108
  	__alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
74768ed83   Jan Beulich   page allocator: u...
109
110
  #define alloc_bootmem_pages_nopanic(x) \
  	__alloc_bootmem_nopanic(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
111
  #define alloc_bootmem_node(pgdat, x) \
71fb2e8f8   Franck Bui-Huu   [PATCH] bootmem: ...
112
  	__alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
113
  #define alloc_bootmem_pages_node(pgdat, x) \
71fb2e8f8   Franck Bui-Huu   [PATCH] bootmem: ...
114
  	__alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
2d0aae416   Tejun Heo   bootmem: reorder ...
115
116
117
118
119
120
121
  #define alloc_bootmem_pages_node_nopanic(pgdat, x) \
  	__alloc_bootmem_node_nopanic(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
  
  #define alloc_bootmem_low(x) \
  	__alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
  #define alloc_bootmem_low_pages(x) \
  	__alloc_bootmem_low(x, PAGE_SIZE, 0)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
122
  #define alloc_bootmem_low_pages_node(pgdat, x) \
71fb2e8f8   Franck Bui-Huu   [PATCH] bootmem: ...
123
  	__alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0)
c6af5e9f8   Johannes Weiner   bootmem: Move nod...
124
125
126
  
  extern int reserve_bootmem_generic(unsigned long addr, unsigned long size,
  				   int flags);
223e8dc92   Johannes Weiner   bootmem: reorder ...
127
128
129
  
  extern void *alloc_bootmem_section(unsigned long size,
  				   unsigned long section_nr);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
130

6f167ec72   Dave Hansen   [PATCH] sparsemem...
131
132
133
134
135
136
137
  #ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP
  extern void *alloc_remap(int nid, unsigned long size);
  #else
  static inline void *alloc_remap(int nid, unsigned long size)
  {
  	return NULL;
  }
f71bf0cac   Franck Bui-Huu   [PATCH] bootmem: ...
138
  #endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
6f167ec72   Dave Hansen   [PATCH] sparsemem...
139

f71bf0cac   Franck Bui-Huu   [PATCH] bootmem: ...
140
141
142
143
144
145
146
147
  extern void *alloc_large_system_hash(const char *tablename,
  				     unsigned long bucketsize,
  				     unsigned long numentries,
  				     int scale,
  				     int flags,
  				     unsigned int *_hash_shift,
  				     unsigned int *_hash_mask,
  				     unsigned long limit);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
148

049036643   Andrew Morton   [PATCH] remove HA...
149
  #define HASH_EARLY	0x00000001	/* Allocating during early boot? */
2c85f51d2   Jan Beulich   mm: also use allo...
150
151
  #define HASH_SMALL	0x00000002	/* sub-page allocation allowed, min
  					 * shift passed via *_hash_shift */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
152

c2fdf3a9b   Anton Blanchard   mm: enable hashdi...
153
154
  /* Only NUMA needs hash distribution. 64bit NUMA architectures have
   * sufficient vmalloc space.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
155
   */
c2fdf3a9b   Anton Blanchard   mm: enable hashdi...
156
  #if defined(CONFIG_NUMA) && defined(CONFIG_64BIT)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
157
158
159
160
  #define HASHDIST_DEFAULT 1
  #else
  #define HASHDIST_DEFAULT 0
  #endif
f034b5d4e   David S. Miller   [XFRM]: Dynamic x...
161
  extern int hashdist;		/* Distribute hashes across NUMA nodes? */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
162
163
164
  
  
  #endif /* _LINUX_BOOTMEM_H */