Skip to content

Commit

Permalink
mm/page_alloc: inline function to handle CONFIG_DEFERRED_STRUCT_PAGE_…
Browse files Browse the repository at this point in the history
…INIT

Let us move the code between CONFIG_DEFERRED_STRUCT_PAGE_INIT to an inline
function.  Not having an ifdef in the function makes the code more
readable.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Oscar Salvador <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Reviewed-by: Pavel Tatashin <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
Cc: Aaron Lu <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Pasha Tatashin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
osalvadorvilardaga authored and torvalds committed Aug 22, 2018
1 parent 7cc2a95 commit 0188dc9
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6364,6 +6364,21 @@ static void __ref alloc_node_mem_map(struct pglist_data *pgdat)
static void __ref alloc_node_mem_map(struct pglist_data *pgdat) { }
#endif /* CONFIG_FLAT_NODE_MEM_MAP */

#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
static inline void pgdat_set_deferred_range(pg_data_t *pgdat)
{
/*
* We start only with one section of pages, more pages are added as
* needed until the rest of deferred pages are initialized.
*/
pgdat->static_init_pgcnt = min_t(unsigned long, PAGES_PER_SECTION,
pgdat->node_spanned_pages);
pgdat->first_deferred_pfn = ULONG_MAX;
}
#else
static inline void pgdat_set_deferred_range(pg_data_t *pgdat) {}
#endif

void __meminit free_area_init_node(int nid, unsigned long *zones_size,
unsigned long node_start_pfn,
unsigned long *zholes_size)
Expand All @@ -6390,16 +6405,8 @@ void __meminit free_area_init_node(int nid, unsigned long *zones_size,
zones_size, zholes_size);

alloc_node_mem_map(pgdat);
pgdat_set_deferred_range(pgdat);

#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
/*
* We start only with one section of pages, more pages are added as
* needed until the rest of deferred pages are initialized.
*/
pgdat->static_init_pgcnt = min_t(unsigned long, PAGES_PER_SECTION,
pgdat->node_spanned_pages);
pgdat->first_deferred_pfn = ULONG_MAX;
#endif
free_area_init_core(pgdat);
}

Expand Down

0 comments on commit 0188dc9

Please sign in to comment.