mm/page_alloc.c: clean code by merging two functions
finalise_ac() is just 'epilogue' for 'prepare_alloc_pages'. Therefore there is no need to keep them both so 'finalise_ac' content can be merged into prepare_alloc_pages() code. It would make __alloc_pages_nodemask() cleaner when it comes to readability. Signed-off-by: Mateusz Nosek <mateusznosek0@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Mike Rapoport <rppt@kernel.org> Link: https://lkml.kernel.org/r/20200916110118.6537-1-mateusznosek0@gmail.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: hongrongxuan <hongrongxuan@huawei.com> Conflicts: mm/page_alloc.c
This commit is contained in:
parent
ae75cd7b60
commit
f78440ef9d
|
@ -4899,12 +4899,6 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order,
|
||||||
if (IS_ENABLED(CONFIG_CMA) && ac->migratetype == MIGRATE_MOVABLE)
|
if (IS_ENABLED(CONFIG_CMA) && ac->migratetype == MIGRATE_MOVABLE)
|
||||||
*alloc_flags |= ALLOC_CMA;
|
*alloc_flags |= ALLOC_CMA;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Determine whether to spread dirty pages and what the first usable zone */
|
|
||||||
static inline void finalise_ac(gfp_t gfp_mask, struct alloc_context *ac)
|
|
||||||
{
|
|
||||||
/* Dirty zone balancing only done in the fast path */
|
/* Dirty zone balancing only done in the fast path */
|
||||||
ac->spread_dirty_pages = (gfp_mask & __GFP_WRITE);
|
ac->spread_dirty_pages = (gfp_mask & __GFP_WRITE);
|
||||||
|
|
||||||
|
@ -4915,6 +4909,8 @@ static inline void finalise_ac(gfp_t gfp_mask, struct alloc_context *ac)
|
||||||
*/
|
*/
|
||||||
ac->preferred_zoneref = first_zones_zonelist(ac->zonelist,
|
ac->preferred_zoneref = first_zones_zonelist(ac->zonelist,
|
||||||
ac->high_zoneidx, ac->nodemask);
|
ac->high_zoneidx, ac->nodemask);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern unsigned int vm_memcg_latency_histogram;
|
extern unsigned int vm_memcg_latency_histogram;
|
||||||
|
@ -4968,8 +4964,6 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid,
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
finalise_ac(gfp_mask, &ac);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Forbid the first pass from falling back to types that fragment
|
* Forbid the first pass from falling back to types that fragment
|
||||||
* memory until all local zones are considered.
|
* memory until all local zones are considered.
|
||||||
|
|
Loading…
Reference in New Issue