diff options
author | Oscar Salvador <osalvador@suse.de> | 2018-08-22 00:53:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-22 13:52:45 -0400 |
commit | ace1db39768cdc58f6b157d99ae5958ad34ffff8 (patch) | |
tree | b0b4a203c4375e620be5626fde160422105ea7aa /mm/page_alloc.c | |
parent | 89696701ea847786f88ccc1c580fb4c3c20c4a3a (diff) |
mm/page_alloc.c: move ifdefery out of free_area_init_core
Patch series "Refactor free_area_init_core and add
free_area_init_core_hotplug", v6.
This patchset does three things:
1) Clean up/refactor free_area_init_core/free_area_init_node
by moving the ifdefery out of the functions.
2) Move the pgdat/zone initialization in free_area_init_core to its
own function.
3) Introduce free_area_init_core_hotplug, a small subset of
free_area_init_core, which is only called from memhotlug code path. In this
way, we have:
free_area_init_core: called during early initialization
free_area_init_core_hotplug: called whenever a new node is allocated/re-used (memhotplug path)
This patch (of 5):
Moving the #ifdefs out of the function makes it easier to follow.
Link: http://lkml.kernel.org/r/20180730101757.28058-2-osalvador@techadventures.net
Signed-off-by: Oscar Salvador <osalvador@suse.de>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Pavel Tatashin <pasha.tatashin@oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Pasha Tatashin <Pavel.Tatashin@microsoft.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Aaron Lu <aaron.lu@intel.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 15ea511fb41c..455cc3bfae99 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -6194,6 +6194,37 @@ static unsigned long __paginginit calc_memmap_size(unsigned long spanned_pages, | |||
6194 | return PAGE_ALIGN(pages * sizeof(struct page)) >> PAGE_SHIFT; | 6194 | return PAGE_ALIGN(pages * sizeof(struct page)) >> PAGE_SHIFT; |
6195 | } | 6195 | } |
6196 | 6196 | ||
6197 | #ifdef CONFIG_NUMA_BALANCING | ||
6198 | static void pgdat_init_numabalancing(struct pglist_data *pgdat) | ||
6199 | { | ||
6200 | spin_lock_init(&pgdat->numabalancing_migrate_lock); | ||
6201 | pgdat->numabalancing_migrate_nr_pages = 0; | ||
6202 | pgdat->numabalancing_migrate_next_window = jiffies; | ||
6203 | } | ||
6204 | #else | ||
6205 | static void pgdat_init_numabalancing(struct pglist_data *pgdat) {} | ||
6206 | #endif | ||
6207 | |||
6208 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
6209 | static void pgdat_init_split_queue(struct pglist_data *pgdat) | ||
6210 | { | ||
6211 | spin_lock_init(&pgdat->split_queue_lock); | ||
6212 | INIT_LIST_HEAD(&pgdat->split_queue); | ||
6213 | pgdat->split_queue_len = 0; | ||
6214 | } | ||
6215 | #else | ||
6216 | static void pgdat_init_split_queue(struct pglist_data *pgdat) {} | ||
6217 | #endif | ||
6218 | |||
6219 | #ifdef CONFIG_COMPACTION | ||
6220 | static void pgdat_init_kcompactd(struct pglist_data *pgdat) | ||
6221 | { | ||
6222 | init_waitqueue_head(&pgdat->kcompactd_wait); | ||
6223 | } | ||
6224 | #else | ||
6225 | static void pgdat_init_kcompactd(struct pglist_data *pgdat) {} | ||
6226 | #endif | ||
6227 | |||
6197 | /* | 6228 | /* |
6198 | * Set up the zone data structures: | 6229 | * Set up the zone data structures: |
6199 | * - mark all pages reserved | 6230 | * - mark all pages reserved |
@@ -6208,21 +6239,14 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat) | |||
6208 | int nid = pgdat->node_id; | 6239 | int nid = pgdat->node_id; |
6209 | 6240 | ||
6210 | pgdat_resize_init(pgdat); | 6241 | pgdat_resize_init(pgdat); |
6211 | #ifdef CONFIG_NUMA_BALANCING | 6242 | |
6212 | spin_lock_init(&pgdat->numabalancing_migrate_lock); | 6243 | pgdat_init_numabalancing(pgdat); |
6213 | pgdat->numabalancing_migrate_nr_pages = 0; | 6244 | pgdat_init_split_queue(pgdat); |
6214 | pgdat->numabalancing_migrate_next_window = jiffies; | 6245 | pgdat_init_kcompactd(pgdat); |
6215 | #endif | 6246 | |
6216 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
6217 | spin_lock_init(&pgdat->split_queue_lock); | ||
6218 | INIT_LIST_HEAD(&pgdat->split_queue); | ||
6219 | pgdat->split_queue_len = 0; | ||
6220 | #endif | ||
6221 | init_waitqueue_head(&pgdat->kswapd_wait); | 6247 | init_waitqueue_head(&pgdat->kswapd_wait); |
6222 | init_waitqueue_head(&pgdat->pfmemalloc_wait); | 6248 | init_waitqueue_head(&pgdat->pfmemalloc_wait); |
6223 | #ifdef CONFIG_COMPACTION | 6249 | |
6224 | init_waitqueue_head(&pgdat->kcompactd_wait); | ||
6225 | #endif | ||
6226 | pgdat_page_ext_init(pgdat); | 6250 | pgdat_page_ext_init(pgdat); |
6227 | spin_lock_init(&pgdat->lru_lock); | 6251 | spin_lock_init(&pgdat->lru_lock); |
6228 | lruvec_init(node_lruvec(pgdat)); | 6252 | lruvec_init(node_lruvec(pgdat)); |