mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 11:03:07 -04:00
mm/page_alloc: drop alloc_flags arg from alloc_flags_cma()
To align the style with other alloc_flags_*() functions, drop this additive argument and just have the callers do that themselves. Note you can't always freely or alloc_flags like these callers do (because of the WMARK bits that encode an enum) but this is fine for ALLOC_CMA, just like it's fine for e.g. ALLOC_NON_BLOCK returned by alloc_flags_nonblocking() and or'd by its caller. Link: https://lore.kernel.org/20260703-alloc-trylock-v5-17-c87b714e19d3@google.com Signed-off-by: Brendan Jackman <jackmanb@google.com> Suggested-by: Vlastimil Babka (SUSE) <vbabka@kernel.org> Link: https://lore.kernel.org/all/5dcdd1ef-21ad-4ed0-9e8a-0e5cf96b4392@kernel.org/ Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org> Reviewed-by: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
01c69ef56d
commit
5df11ba0eb
@@ -3775,14 +3775,13 @@ alloc_flags_nofragment(struct zone *zone, gfp_t gfp_mask)
|
||||
}
|
||||
|
||||
/* Must be called after current_gfp_context() which can change gfp_mask */
|
||||
static inline unsigned int alloc_flags_cma(gfp_t gfp_mask,
|
||||
unsigned int alloc_flags)
|
||||
static inline unsigned int alloc_flags_cma(gfp_t gfp_mask)
|
||||
{
|
||||
#ifdef CONFIG_CMA
|
||||
if (gfp_migratetype(gfp_mask) == MIGRATE_MOVABLE)
|
||||
alloc_flags |= ALLOC_CMA;
|
||||
return ALLOC_CMA;
|
||||
#endif
|
||||
return alloc_flags;
|
||||
return ALLOC_DEFAULT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4526,7 +4525,7 @@ alloc_flags_slowpath(gfp_t gfp_mask, unsigned int order)
|
||||
} else if (unlikely(rt_or_dl_task(current)) && in_task())
|
||||
alloc_flags |= ALLOC_MIN_RESERVE;
|
||||
|
||||
alloc_flags = alloc_flags_cma(gfp_mask, alloc_flags);
|
||||
alloc_flags |= alloc_flags_cma(gfp_mask);
|
||||
|
||||
if (defrag_mode)
|
||||
alloc_flags |= ALLOC_NOFRAGMENT;
|
||||
@@ -4837,7 +4836,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
|
||||
|
||||
reserve_flags = __gfp_pfmemalloc_flags(gfp_mask);
|
||||
if (reserve_flags)
|
||||
alloc_flags = alloc_flags_cma(gfp_mask, reserve_flags) |
|
||||
alloc_flags = alloc_flags_cma(gfp_mask) | reserve_flags |
|
||||
ac->alloc_flags | (alloc_flags & ALLOC_KSWAPD);
|
||||
|
||||
/*
|
||||
@@ -5070,7 +5069,7 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order,
|
||||
should_fail_alloc_page(gfp_mask, order))
|
||||
return false;
|
||||
|
||||
*alloc_flags = alloc_flags_cma(gfp_mask, *alloc_flags);
|
||||
*alloc_flags |= alloc_flags_cma(gfp_mask);
|
||||
|
||||
/* Dirty zone balancing only done in the fast path */
|
||||
ac->spread_dirty_pages = (gfp_mask & __GFP_WRITE);
|
||||
|
||||
Reference in New Issue
Block a user