diff options
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1521100f1e63..3674e42e3620 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -155,16 +155,17 @@ static inline void set_pcppage_migratetype(struct page *page, int migratetype) | |||
155 | * The following functions are used by the suspend/hibernate code to temporarily | 155 | * The following functions are used by the suspend/hibernate code to temporarily |
156 | * change gfp_allowed_mask in order to avoid using I/O during memory allocations | 156 | * change gfp_allowed_mask in order to avoid using I/O during memory allocations |
157 | * while devices are suspended. To avoid races with the suspend/hibernate code, | 157 | * while devices are suspended. To avoid races with the suspend/hibernate code, |
158 | * they should always be called with pm_mutex held (gfp_allowed_mask also should | 158 | * they should always be called with system_transition_mutex held |
159 | * only be modified with pm_mutex held, unless the suspend/hibernate code is | 159 | * (gfp_allowed_mask also should only be modified with system_transition_mutex |
160 | * guaranteed not to run in parallel with that modification). | 160 | * held, unless the suspend/hibernate code is guaranteed not to run in parallel |
161 | * with that modification). | ||
161 | */ | 162 | */ |
162 | 163 | ||
163 | static gfp_t saved_gfp_mask; | 164 | static gfp_t saved_gfp_mask; |
164 | 165 | ||
165 | void pm_restore_gfp_mask(void) | 166 | void pm_restore_gfp_mask(void) |
166 | { | 167 | { |
167 | WARN_ON(!mutex_is_locked(&pm_mutex)); | 168 | WARN_ON(!mutex_is_locked(&system_transition_mutex)); |
168 | if (saved_gfp_mask) { | 169 | if (saved_gfp_mask) { |
169 | gfp_allowed_mask = saved_gfp_mask; | 170 | gfp_allowed_mask = saved_gfp_mask; |
170 | saved_gfp_mask = 0; | 171 | saved_gfp_mask = 0; |
@@ -173,7 +174,7 @@ void pm_restore_gfp_mask(void) | |||
173 | 174 | ||
174 | void pm_restrict_gfp_mask(void) | 175 | void pm_restrict_gfp_mask(void) |
175 | { | 176 | { |
176 | WARN_ON(!mutex_is_locked(&pm_mutex)); | 177 | WARN_ON(!mutex_is_locked(&system_transition_mutex)); |
177 | WARN_ON(saved_gfp_mask); | 178 | WARN_ON(saved_gfp_mask); |
178 | saved_gfp_mask = gfp_allowed_mask; | 179 | saved_gfp_mask = gfp_allowed_mask; |
179 | gfp_allowed_mask &= ~(__GFP_IO | __GFP_FS); | 180 | gfp_allowed_mask &= ~(__GFP_IO | __GFP_FS); |
@@ -6383,7 +6384,7 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size, | |||
6383 | free_area_init_core(pgdat); | 6384 | free_area_init_core(pgdat); |
6384 | } | 6385 | } |
6385 | 6386 | ||
6386 | #ifdef CONFIG_HAVE_MEMBLOCK | 6387 | #if defined(CONFIG_HAVE_MEMBLOCK) && !defined(CONFIG_FLAT_NODE_MEM_MAP) |
6387 | /* | 6388 | /* |
6388 | * Only struct pages that are backed by physical memory are zeroed and | 6389 | * Only struct pages that are backed by physical memory are zeroed and |
6389 | * initialized by going through __init_single_page(). But, there are some | 6390 | * initialized by going through __init_single_page(). But, there are some |
@@ -6421,7 +6422,7 @@ void __paginginit zero_resv_unavail(void) | |||
6421 | if (pgcnt) | 6422 | if (pgcnt) |
6422 | pr_info("Reserved but unavailable: %lld pages", pgcnt); | 6423 | pr_info("Reserved but unavailable: %lld pages", pgcnt); |
6423 | } | 6424 | } |
6424 | #endif /* CONFIG_HAVE_MEMBLOCK */ | 6425 | #endif /* CONFIG_HAVE_MEMBLOCK && !CONFIG_FLAT_NODE_MEM_MAP */ |
6425 | 6426 | ||
6426 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP | 6427 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP |
6427 | 6428 | ||
@@ -6847,6 +6848,7 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn) | |||
6847 | /* Initialise every node */ | 6848 | /* Initialise every node */ |
6848 | mminit_verify_pageflags_layout(); | 6849 | mminit_verify_pageflags_layout(); |
6849 | setup_nr_node_ids(); | 6850 | setup_nr_node_ids(); |
6851 | zero_resv_unavail(); | ||
6850 | for_each_online_node(nid) { | 6852 | for_each_online_node(nid) { |
6851 | pg_data_t *pgdat = NODE_DATA(nid); | 6853 | pg_data_t *pgdat = NODE_DATA(nid); |
6852 | free_area_init_node(nid, NULL, | 6854 | free_area_init_node(nid, NULL, |
@@ -6857,7 +6859,6 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn) | |||
6857 | node_set_state(nid, N_MEMORY); | 6859 | node_set_state(nid, N_MEMORY); |
6858 | check_for_memory(pgdat, nid); | 6860 | check_for_memory(pgdat, nid); |
6859 | } | 6861 | } |
6860 | zero_resv_unavail(); | ||
6861 | } | 6862 | } |
6862 | 6863 | ||
6863 | static int __init cmdline_parse_core(char *p, unsigned long *core, | 6864 | static int __init cmdline_parse_core(char *p, unsigned long *core, |
@@ -7033,9 +7034,9 @@ void __init set_dma_reserve(unsigned long new_dma_reserve) | |||
7033 | 7034 | ||
7034 | void __init free_area_init(unsigned long *zones_size) | 7035 | void __init free_area_init(unsigned long *zones_size) |
7035 | { | 7036 | { |
7037 | zero_resv_unavail(); | ||
7036 | free_area_init_node(0, zones_size, | 7038 | free_area_init_node(0, zones_size, |
7037 | __pa(PAGE_OFFSET) >> PAGE_SHIFT, NULL); | 7039 | __pa(PAGE_OFFSET) >> PAGE_SHIFT, NULL); |
7038 | zero_resv_unavail(); | ||
7039 | } | 7040 | } |
7040 | 7041 | ||
7041 | static int page_alloc_cpu_dead(unsigned int cpu) | 7042 | static int page_alloc_cpu_dead(unsigned int cpu) |