~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/linux/mmzone.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _LINUX_MMZONE_H
  2 #define _LINUX_MMZONE_H
  3 
  4 #ifdef __KERNEL__
  5 #ifndef __ASSEMBLY__
  6 
  7 #include <linux/config.h>
  8 #include <linux/spinlock.h>
  9 #include <linux/list.h>
 10 
 11 /*
 12  * Free memory management - zoned buddy allocator.
 13  */
 14 
 15 #define MAX_ORDER 10
 16 
 17 typedef struct free_area_struct {
 18         struct list_head        free_list;
 19         unsigned int            *map;
 20 } free_area_t;
 21 
 22 struct pglist_data;
 23 
 24 typedef struct zone_struct {
 25         /*
 26          * Commonly accessed fields:
 27          */
 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;
 34 
 35         /*
 36          * free areas of different sizes
 37          */
 38         struct list_head        inactive_clean_list;
 39         free_area_t             free_area[MAX_ORDER];
 40 
 41         /*
 42          * rarely used fields:
 43          */
 44         char                    *name;
 45         unsigned long           size;
 46         /*
 47          * Discontig memory support fields.
 48          */
 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;
 54 
 55 #define ZONE_DMA                0
 56 #define ZONE_NORMAL             1
 57 #define ZONE_HIGHMEM            2
 58 #define MAX_NR_ZONES            3
 59 
 60 /*
 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.
 65  *
 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.
 70  */
 71 typedef struct zonelist_struct {
 72         zone_t * zones [MAX_NR_ZONES+1]; // NULL delimited
 73         int gfp_mask;
 74 } zonelist_t;
 75 
 76 #define NR_GFPINDEX             0x100
 77 
 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;
 91 
 92 extern int numnodes;
 93 extern pg_data_t *pgdat_list;
 94 
 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)))
 98 
 99 /*
100  * The following two are not meant for general usage. They are here as
101  * prototypes for the discontig memory code.
102  */
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);
108 
109 extern pg_data_t contig_page_data;
110 
111 #ifndef CONFIG_DISCONTIGMEM
112 
113 #define NODE_DATA(nid)          (&contig_page_data)
114 #define NODE_MEM_MAP(nid)       mem_map
115 
116 #else /* !CONFIG_DISCONTIGMEM */
117 
118 #include <asm/mmzone.h>
119 
120 #endif /* !CONFIG_DISCONTIGMEM */
121 
122 #define MAP_ALIGN(x)    ((((x) % sizeof(mem_map_t)) == 0) ? (x) : ((x) + \
123                 sizeof(mem_map_t) - ((x) % sizeof(mem_map_t))))
124 
125 #endif /* !__ASSEMBLY__ */
126 #endif /* __KERNEL__ */
127 #endif /* _LINUX_MMZONE_H */
128 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.