diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-21 22:05:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-21 22:05:45 -0500 |
commit | df32e43a54d04eda35d2859beaf90e3864d53288 (patch) | |
tree | 7a61cf658b2949bd426285eb9902be7758ced1ba /mm/page_alloc.c | |
parent | fbd918a2026d0464ce9c23f57b7de4bcfccdc2e6 (diff) | |
parent | 78d5506e82b21a1a1de68c24182db2c2fe521422 (diff) |
Merge branch 'akpm' (incoming from Andrew)
Merge first patch-bomb from Andrew Morton:
- a couple of misc things
- inotify/fsnotify work from Jan
- ocfs2 updates (partial)
- about half of MM
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (117 commits)
mm/migrate: remove unused function, fail_migrate_page()
mm/migrate: remove putback_lru_pages, fix comment on putback_movable_pages
mm/migrate: correct failure handling if !hugepage_migration_support()
mm/migrate: add comment about permanent failure path
mm, page_alloc: warn for non-blockable __GFP_NOFAIL allocation failure
mm: compaction: reset scanner positions immediately when they meet
mm: compaction: do not mark unmovable pageblocks as skipped in async compaction
mm: compaction: detect when scanners meet in isolate_freepages
mm: compaction: reset cached scanner pfn's before reading them
mm: compaction: encapsulate defer reset logic
mm: compaction: trace compaction begin and end
memcg, oom: lock mem_cgroup_print_oom_info
sched: add tracepoints related to NUMA task migration
mm: numa: do not automatically migrate KSM pages
mm: numa: trace tasks that fail migration due to rate limiting
mm: numa: limit scope of lock for NUMA migrate rate limiting
mm: numa: make NUMA-migrate related functions static
lib/show_mem.c: show num_poisoned_pages when oom
mm/hwpoison: add '#' to hwpoison_inject
mm/memblock: use WARN_ONCE when MAX_NUMNODES passed as input parameter
...
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 89 |
1 files changed, 63 insertions, 26 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 5248fe070aa4..533e2147d14f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2072,13 +2072,6 @@ void warn_alloc_failed(gfp_t gfp_mask, int order, const char *fmt, ...) | |||
2072 | return; | 2072 | return; |
2073 | 2073 | ||
2074 | /* | 2074 | /* |
2075 | * Walking all memory to count page types is very expensive and should | ||
2076 | * be inhibited in non-blockable contexts. | ||
2077 | */ | ||
2078 | if (!(gfp_mask & __GFP_WAIT)) | ||
2079 | filter |= SHOW_MEM_FILTER_PAGE_COUNT; | ||
2080 | |||
2081 | /* | ||
2082 | * This documents exceptions given to allocations in certain | 2075 | * This documents exceptions given to allocations in certain |
2083 | * contexts that are allowed to allocate outside current's set | 2076 | * contexts that are allowed to allocate outside current's set |
2084 | * of allowed nodes. | 2077 | * of allowed nodes. |
@@ -2242,10 +2235,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, | |||
2242 | preferred_zone, migratetype); | 2235 | preferred_zone, migratetype); |
2243 | if (page) { | 2236 | if (page) { |
2244 | preferred_zone->compact_blockskip_flush = false; | 2237 | preferred_zone->compact_blockskip_flush = false; |
2245 | preferred_zone->compact_considered = 0; | 2238 | compaction_defer_reset(preferred_zone, order, true); |
2246 | preferred_zone->compact_defer_shift = 0; | ||
2247 | if (order >= preferred_zone->compact_order_failed) | ||
2248 | preferred_zone->compact_order_failed = order + 1; | ||
2249 | count_vm_event(COMPACTSUCCESS); | 2239 | count_vm_event(COMPACTSUCCESS); |
2250 | return page; | 2240 | return page; |
2251 | } | 2241 | } |
@@ -2535,8 +2525,15 @@ rebalance: | |||
2535 | } | 2525 | } |
2536 | 2526 | ||
2537 | /* Atomic allocations - we can't balance anything */ | 2527 | /* Atomic allocations - we can't balance anything */ |
2538 | if (!wait) | 2528 | if (!wait) { |
2529 | /* | ||
2530 | * All existing users of the deprecated __GFP_NOFAIL are | ||
2531 | * blockable, so warn of any new users that actually allow this | ||
2532 | * type of allocation to fail. | ||
2533 | */ | ||
2534 | WARN_ON_ONCE(gfp_mask & __GFP_NOFAIL); | ||
2539 | goto nopage; | 2535 | goto nopage; |
2536 | } | ||
2540 | 2537 | ||
2541 | /* Avoid recursion of direct reclaim */ | 2538 | /* Avoid recursion of direct reclaim */ |
2542 | if (current->flags & PF_MEMALLOC) | 2539 | if (current->flags & PF_MEMALLOC) |
@@ -3901,6 +3898,7 @@ static void setup_zone_migrate_reserve(struct zone *zone) | |||
3901 | struct page *page; | 3898 | struct page *page; |
3902 | unsigned long block_migratetype; | 3899 | unsigned long block_migratetype; |
3903 | int reserve; | 3900 | int reserve; |
3901 | int old_reserve; | ||
3904 | 3902 | ||
3905 | /* | 3903 | /* |
3906 | * Get the start pfn, end pfn and the number of blocks to reserve | 3904 | * Get the start pfn, end pfn and the number of blocks to reserve |
@@ -3922,6 +3920,12 @@ static void setup_zone_migrate_reserve(struct zone *zone) | |||
3922 | * future allocation of hugepages at runtime. | 3920 | * future allocation of hugepages at runtime. |
3923 | */ | 3921 | */ |
3924 | reserve = min(2, reserve); | 3922 | reserve = min(2, reserve); |
3923 | old_reserve = zone->nr_migrate_reserve_block; | ||
3924 | |||
3925 | /* When memory hot-add, we almost always need to do nothing */ | ||
3926 | if (reserve == old_reserve) | ||
3927 | return; | ||
3928 | zone->nr_migrate_reserve_block = reserve; | ||
3925 | 3929 | ||
3926 | for (pfn = start_pfn; pfn < end_pfn; pfn += pageblock_nr_pages) { | 3930 | for (pfn = start_pfn; pfn < end_pfn; pfn += pageblock_nr_pages) { |
3927 | if (!pfn_valid(pfn)) | 3931 | if (!pfn_valid(pfn)) |
@@ -3959,6 +3963,12 @@ static void setup_zone_migrate_reserve(struct zone *zone) | |||
3959 | reserve--; | 3963 | reserve--; |
3960 | continue; | 3964 | continue; |
3961 | } | 3965 | } |
3966 | } else if (!old_reserve) { | ||
3967 | /* | ||
3968 | * At boot time we don't need to scan the whole zone | ||
3969 | * for turning off MIGRATE_RESERVE. | ||
3970 | */ | ||
3971 | break; | ||
3962 | } | 3972 | } |
3963 | 3973 | ||
3964 | /* | 3974 | /* |
@@ -4209,7 +4219,6 @@ static noinline __init_refok | |||
4209 | int zone_wait_table_init(struct zone *zone, unsigned long zone_size_pages) | 4219 | int zone_wait_table_init(struct zone *zone, unsigned long zone_size_pages) |
4210 | { | 4220 | { |
4211 | int i; | 4221 | int i; |
4212 | struct pglist_data *pgdat = zone->zone_pgdat; | ||
4213 | size_t alloc_size; | 4222 | size_t alloc_size; |
4214 | 4223 | ||
4215 | /* | 4224 | /* |
@@ -4225,7 +4234,8 @@ int zone_wait_table_init(struct zone *zone, unsigned long zone_size_pages) | |||
4225 | 4234 | ||
4226 | if (!slab_is_available()) { | 4235 | if (!slab_is_available()) { |
4227 | zone->wait_table = (wait_queue_head_t *) | 4236 | zone->wait_table = (wait_queue_head_t *) |
4228 | alloc_bootmem_node_nopanic(pgdat, alloc_size); | 4237 | memblock_virt_alloc_node_nopanic( |
4238 | alloc_size, zone->zone_pgdat->node_id); | ||
4229 | } else { | 4239 | } else { |
4230 | /* | 4240 | /* |
4231 | * This case means that a zone whose size was 0 gets new memory | 4241 | * This case means that a zone whose size was 0 gets new memory |
@@ -4345,13 +4355,14 @@ bool __meminit early_pfn_in_nid(unsigned long pfn, int node) | |||
4345 | #endif | 4355 | #endif |
4346 | 4356 | ||
4347 | /** | 4357 | /** |
4348 | * free_bootmem_with_active_regions - Call free_bootmem_node for each active range | 4358 | * free_bootmem_with_active_regions - Call memblock_free_early_nid for each active range |
4349 | * @nid: The node to free memory on. If MAX_NUMNODES, all nodes are freed. | 4359 | * @nid: The node to free memory on. If MAX_NUMNODES, all nodes are freed. |
4350 | * @max_low_pfn: The highest PFN that will be passed to free_bootmem_node | 4360 | * @max_low_pfn: The highest PFN that will be passed to memblock_free_early_nid |
4351 | * | 4361 | * |
4352 | * If an architecture guarantees that all ranges registered with | 4362 | * If an architecture guarantees that all ranges registered with |
4353 | * add_active_ranges() contain no holes and may be freed, this | 4363 | * add_active_ranges() contain no holes and may be freed, this |
4354 | * this function may be used instead of calling free_bootmem() manually. | 4364 | * this function may be used instead of calling memblock_free_early_nid() |
4365 | * manually. | ||
4355 | */ | 4366 | */ |
4356 | void __init free_bootmem_with_active_regions(int nid, unsigned long max_low_pfn) | 4367 | void __init free_bootmem_with_active_regions(int nid, unsigned long max_low_pfn) |
4357 | { | 4368 | { |
@@ -4363,9 +4374,9 @@ void __init free_bootmem_with_active_regions(int nid, unsigned long max_low_pfn) | |||
4363 | end_pfn = min(end_pfn, max_low_pfn); | 4374 | end_pfn = min(end_pfn, max_low_pfn); |
4364 | 4375 | ||
4365 | if (start_pfn < end_pfn) | 4376 | if (start_pfn < end_pfn) |
4366 | free_bootmem_node(NODE_DATA(this_nid), | 4377 | memblock_free_early_nid(PFN_PHYS(start_pfn), |
4367 | PFN_PHYS(start_pfn), | 4378 | (end_pfn - start_pfn) << PAGE_SHIFT, |
4368 | (end_pfn - start_pfn) << PAGE_SHIFT); | 4379 | this_nid); |
4369 | } | 4380 | } |
4370 | } | 4381 | } |
4371 | 4382 | ||
@@ -4636,8 +4647,9 @@ static void __init setup_usemap(struct pglist_data *pgdat, | |||
4636 | unsigned long usemapsize = usemap_size(zone_start_pfn, zonesize); | 4647 | unsigned long usemapsize = usemap_size(zone_start_pfn, zonesize); |
4637 | zone->pageblock_flags = NULL; | 4648 | zone->pageblock_flags = NULL; |
4638 | if (usemapsize) | 4649 | if (usemapsize) |
4639 | zone->pageblock_flags = alloc_bootmem_node_nopanic(pgdat, | 4650 | zone->pageblock_flags = |
4640 | usemapsize); | 4651 | memblock_virt_alloc_node_nopanic(usemapsize, |
4652 | pgdat->node_id); | ||
4641 | } | 4653 | } |
4642 | #else | 4654 | #else |
4643 | static inline void setup_usemap(struct pglist_data *pgdat, struct zone *zone, | 4655 | static inline void setup_usemap(struct pglist_data *pgdat, struct zone *zone, |
@@ -4831,7 +4843,8 @@ static void __init_refok alloc_node_mem_map(struct pglist_data *pgdat) | |||
4831 | size = (end - start) * sizeof(struct page); | 4843 | size = (end - start) * sizeof(struct page); |
4832 | map = alloc_remap(pgdat->node_id, size); | 4844 | map = alloc_remap(pgdat->node_id, size); |
4833 | if (!map) | 4845 | if (!map) |
4834 | map = alloc_bootmem_node_nopanic(pgdat, size); | 4846 | map = memblock_virt_alloc_node_nopanic(size, |
4847 | pgdat->node_id); | ||
4835 | pgdat->node_mem_map = map + (pgdat->node_start_pfn - start); | 4848 | pgdat->node_mem_map = map + (pgdat->node_start_pfn - start); |
4836 | } | 4849 | } |
4837 | #ifndef CONFIG_NEED_MULTIPLE_NODES | 4850 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
@@ -5012,9 +5025,33 @@ static void __init find_zone_movable_pfns_for_nodes(void) | |||
5012 | nodemask_t saved_node_state = node_states[N_MEMORY]; | 5025 | nodemask_t saved_node_state = node_states[N_MEMORY]; |
5013 | unsigned long totalpages = early_calculate_totalpages(); | 5026 | unsigned long totalpages = early_calculate_totalpages(); |
5014 | int usable_nodes = nodes_weight(node_states[N_MEMORY]); | 5027 | int usable_nodes = nodes_weight(node_states[N_MEMORY]); |
5028 | struct memblock_type *type = &memblock.memory; | ||
5029 | |||
5030 | /* Need to find movable_zone earlier when movable_node is specified. */ | ||
5031 | find_usable_zone_for_movable(); | ||
5032 | |||
5033 | /* | ||
5034 | * If movable_node is specified, ignore kernelcore and movablecore | ||
5035 | * options. | ||
5036 | */ | ||
5037 | if (movable_node_is_enabled()) { | ||
5038 | for (i = 0; i < type->cnt; i++) { | ||
5039 | if (!memblock_is_hotpluggable(&type->regions[i])) | ||
5040 | continue; | ||
5041 | |||
5042 | nid = type->regions[i].nid; | ||
5043 | |||
5044 | usable_startpfn = PFN_DOWN(type->regions[i].base); | ||
5045 | zone_movable_pfn[nid] = zone_movable_pfn[nid] ? | ||
5046 | min(usable_startpfn, zone_movable_pfn[nid]) : | ||
5047 | usable_startpfn; | ||
5048 | } | ||
5049 | |||
5050 | goto out2; | ||
5051 | } | ||
5015 | 5052 | ||
5016 | /* | 5053 | /* |
5017 | * If movablecore was specified, calculate what size of | 5054 | * If movablecore=nn[KMG] was specified, calculate what size of |
5018 | * kernelcore that corresponds so that memory usable for | 5055 | * kernelcore that corresponds so that memory usable for |
5019 | * any allocation type is evenly spread. If both kernelcore | 5056 | * any allocation type is evenly spread. If both kernelcore |
5020 | * and movablecore are specified, then the value of kernelcore | 5057 | * and movablecore are specified, then the value of kernelcore |
@@ -5040,7 +5077,6 @@ static void __init find_zone_movable_pfns_for_nodes(void) | |||
5040 | goto out; | 5077 | goto out; |
5041 | 5078 | ||
5042 | /* usable_startpfn is the lowest possible pfn ZONE_MOVABLE can be at */ | 5079 | /* usable_startpfn is the lowest possible pfn ZONE_MOVABLE can be at */ |
5043 | find_usable_zone_for_movable(); | ||
5044 | usable_startpfn = arch_zone_lowest_possible_pfn[movable_zone]; | 5080 | usable_startpfn = arch_zone_lowest_possible_pfn[movable_zone]; |
5045 | 5081 | ||
5046 | restart: | 5082 | restart: |
@@ -5131,6 +5167,7 @@ restart: | |||
5131 | if (usable_nodes && required_kernelcore > usable_nodes) | 5167 | if (usable_nodes && required_kernelcore > usable_nodes) |
5132 | goto restart; | 5168 | goto restart; |
5133 | 5169 | ||
5170 | out2: | ||
5134 | /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */ | 5171 | /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */ |
5135 | for (nid = 0; nid < MAX_NUMNODES; nid++) | 5172 | for (nid = 0; nid < MAX_NUMNODES; nid++) |
5136 | zone_movable_pfn[nid] = | 5173 | zone_movable_pfn[nid] = |
@@ -5857,7 +5894,7 @@ void *__init alloc_large_system_hash(const char *tablename, | |||
5857 | do { | 5894 | do { |
5858 | size = bucketsize << log2qty; | 5895 | size = bucketsize << log2qty; |
5859 | if (flags & HASH_EARLY) | 5896 | if (flags & HASH_EARLY) |
5860 | table = alloc_bootmem_nopanic(size); | 5897 | table = memblock_virt_alloc_nopanic(size, 0); |
5861 | else if (hashdist) | 5898 | else if (hashdist) |
5862 | table = __vmalloc(size, GFP_ATOMIC, PAGE_KERNEL); | 5899 | table = __vmalloc(size, GFP_ATOMIC, PAGE_KERNEL); |
5863 | else { | 5900 | else { |