diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/mm.h | 47 | ||||
-rw-r--r-- | include/linux/mmzone.h | 10 |
2 files changed, 56 insertions, 1 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 856f0ee7e84a..c0402da7cce0 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -937,6 +937,53 @@ extern void free_area_init(unsigned long * zones_size); | |||
937 | extern void free_area_init_node(int nid, pg_data_t *pgdat, | 937 | extern void free_area_init_node(int nid, pg_data_t *pgdat, |
938 | unsigned long * zones_size, unsigned long zone_start_pfn, | 938 | unsigned long * zones_size, unsigned long zone_start_pfn, |
939 | unsigned long *zholes_size); | 939 | unsigned long *zholes_size); |
940 | #ifdef CONFIG_ARCH_POPULATES_NODE_MAP | ||
941 | /* | ||
942 | * With CONFIG_ARCH_POPULATES_NODE_MAP set, an architecture may initialise its | ||
943 | * zones, allocate the backing mem_map and account for memory holes in a more | ||
944 | * architecture independent manner. This is a substitute for creating the | ||
945 | * zone_sizes[] and zholes_size[] arrays and passing them to | ||
946 | * free_area_init_node() | ||
947 | * | ||
948 | * An architecture is expected to register range of page frames backed by | ||
949 | * physical memory with add_active_range() before calling | ||
950 | * free_area_init_nodes() passing in the PFN each zone ends at. At a basic | ||
951 | * usage, an architecture is expected to do something like | ||
952 | * | ||
953 | * unsigned long max_zone_pfns[MAX_NR_ZONES] = {max_dma, max_normal_pfn, | ||
954 | * max_highmem_pfn}; | ||
955 | * for_each_valid_physical_page_range() | ||
956 | * add_active_range(node_id, start_pfn, end_pfn) | ||
957 | * free_area_init_nodes(max_zone_pfns); | ||
958 | * | ||
959 | * If the architecture guarantees that there are no holes in the ranges | ||
960 | * registered with add_active_range(), free_bootmem_active_regions() | ||
961 | * will call free_bootmem_node() for each registered physical page range. | ||
962 | * Similarly sparse_memory_present_with_active_regions() calls | ||
963 | * memory_present() for each range when SPARSEMEM is enabled. | ||
964 | * | ||
965 | * See mm/page_alloc.c for more information on each function exposed by | ||
966 | * CONFIG_ARCH_POPULATES_NODE_MAP | ||
967 | */ | ||
968 | extern void free_area_init_nodes(unsigned long *max_zone_pfn); | ||
969 | extern void add_active_range(unsigned int nid, unsigned long start_pfn, | ||
970 | unsigned long end_pfn); | ||
971 | extern void shrink_active_range(unsigned int nid, unsigned long old_end_pfn, | ||
972 | unsigned long new_end_pfn); | ||
973 | extern void remove_all_active_ranges(void); | ||
974 | extern unsigned long absent_pages_in_range(unsigned long start_pfn, | ||
975 | unsigned long end_pfn); | ||
976 | extern void get_pfn_range_for_nid(unsigned int nid, | ||
977 | unsigned long *start_pfn, unsigned long *end_pfn); | ||
978 | extern unsigned long find_min_pfn_with_active_regions(void); | ||
979 | extern unsigned long find_max_pfn_with_active_regions(void); | ||
980 | extern void free_bootmem_with_active_regions(int nid, | ||
981 | unsigned long max_low_pfn); | ||
982 | extern void sparse_memory_present_with_active_regions(int nid); | ||
983 | #ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID | ||
984 | extern int early_pfn_to_nid(unsigned long pfn); | ||
985 | #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */ | ||
986 | #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ | ||
940 | extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long); | 987 | extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long); |
941 | extern void setup_per_zone_pages_min(void); | 988 | extern void setup_per_zone_pages_min(void); |
942 | extern void mem_init(void); | 989 | extern void mem_init(void); |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 3693f1a52788..7fa1cbe9fa7a 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -305,6 +305,13 @@ struct zonelist { | |||
305 | struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited | 305 | struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited |
306 | }; | 306 | }; |
307 | 307 | ||
308 | #ifdef CONFIG_ARCH_POPULATES_NODE_MAP | ||
309 | struct node_active_region { | ||
310 | unsigned long start_pfn; | ||
311 | unsigned long end_pfn; | ||
312 | int nid; | ||
313 | }; | ||
314 | #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ | ||
308 | 315 | ||
309 | /* | 316 | /* |
310 | * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM | 317 | * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM |
@@ -518,7 +525,8 @@ extern struct zone *next_zone(struct zone *zone); | |||
518 | 525 | ||
519 | #endif | 526 | #endif |
520 | 527 | ||
521 | #ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID | 528 | #if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \ |
529 | !defined(CONFIG_ARCH_POPULATES_NODE_MAP) | ||
522 | #define early_pfn_to_nid(nid) (0UL) | 530 | #define early_pfn_to_nid(nid) (0UL) |
523 | #endif | 531 | #endif |
524 | 532 | ||