More Makefile cleanups, otherwise mainly noticeable are the netfilter fix
[davej-history.git] / include / linux / mmzone.h
blobc14decdfcac6947627eef8527dd7eb45a6bcb4e2
1 #ifndef _LINUX_MMZONE_H
2 #define _LINUX_MMZONE_H
4 #ifdef __KERNEL__
5 #ifndef __ASSEMBLY__
7 #include <linux/config.h>
8 #include <linux/spinlock.h>
9 #include <linux/list.h>
12 * Free memory management - zoned buddy allocator.
15 #define MAX_ORDER 10
17 typedef struct free_area_struct {
18 struct list_head free_list;
19 unsigned int *map;
20 } free_area_t;
22 struct pglist_data;
24 typedef struct zone_struct {
26 * Commonly accessed fields:
28 spinlock_t lock;
29 unsigned long offset;
30 unsigned long free_pages;
31 unsigned long inactive_clean_pages;
32 unsigned long inactive_dirty_pages;
33 unsigned long pages_min, pages_low, pages_high;
36 * free areas of different sizes
38 struct list_head inactive_clean_list;
39 free_area_t free_area[MAX_ORDER];
42 * rarely used fields:
44 char *name;
45 unsigned long size;
47 * Discontig memory support fields.
49 struct pglist_data *zone_pgdat;
50 unsigned long zone_start_paddr;
51 unsigned long zone_start_mapnr;
52 struct page *zone_mem_map;
53 } zone_t;
55 #define ZONE_DMA 0
56 #define ZONE_NORMAL 1
57 #define ZONE_HIGHMEM 2
58 #define MAX_NR_ZONES 3
61 * One allocation request operates on a zonelist. A zonelist
62 * is a list of zones, the first one is the 'goal' of the
63 * allocation, the other zones are fallback zones, in decreasing
64 * priority.
66 * Right now a zonelist takes up less than a cacheline. We never
67 * modify it apart from boot-up, and only a few indices are used,
68 * so despite the zonelist table being relatively big, the cache
69 * footprint of this construct is very small.
71 typedef struct zonelist_struct {
72 zone_t * zones [MAX_NR_ZONES+1]; // NULL delimited
73 int gfp_mask;
74 } zonelist_t;
76 #define NR_GFPINDEX 0x100
78 struct bootmem_data;
79 typedef struct pglist_data {
80 zone_t node_zones[MAX_NR_ZONES];
81 zonelist_t node_zonelists[NR_GFPINDEX];
82 struct page *node_mem_map;
83 unsigned long *valid_addr_bitmap;
84 struct bootmem_data *bdata;
85 unsigned long node_start_paddr;
86 unsigned long node_start_mapnr;
87 unsigned long node_size;
88 int node_id;
89 struct pglist_data *node_next;
90 } pg_data_t;
92 extern int numnodes;
93 extern pg_data_t *pgdat_list;
95 #define memclass(pgzone, tzone) (((pgzone)->zone_pgdat == (tzone)->zone_pgdat) \
96 && (((pgzone) - (pgzone)->zone_pgdat->node_zones) <= \
97 ((tzone) - (pgzone)->zone_pgdat->node_zones)))
100 * The following two are not meant for general usage. They are here as
101 * prototypes for the discontig memory code.
103 struct page;
104 extern void show_free_areas_core(pg_data_t *pgdat);
105 extern void free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap,
106 unsigned long *zones_size, unsigned long paddr, unsigned long *zholes_size,
107 struct page *pmap);
109 extern pg_data_t contig_page_data;
111 #ifndef CONFIG_DISCONTIGMEM
113 #define NODE_DATA(nid) (&contig_page_data)
114 #define NODE_MEM_MAP(nid) mem_map
116 #else /* !CONFIG_DISCONTIGMEM */
118 #include <asm/mmzone.h>
120 #endif /* !CONFIG_DISCONTIGMEM */
122 #define MAP_ALIGN(x) ((((x) % sizeof(mem_map_t)) == 0) ? (x) : ((x) + \
123 sizeof(mem_map_t) - ((x) % sizeof(mem_map_t))))
125 #endif /* !__ASSEMBLY__ */
126 #endif /* __KERNEL__ */
127 #endif /* _LINUX_MMZONE_H */