Hi,

[...]
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index c93e801a45e9..3f17c73ad582 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -3807,16 +3807,13 @@ alloc_flags_nofragment(struct zone *zone, gfp_t 
> gfp_mask)
>       return alloc_flags;
>  }
>  
> -static inline unsigned int current_alloc_flags(gfp_t gfp_mask,
> -                                     unsigned int alloc_flags)
> +/* Must be called after current_gfp_context() which can change gfp_mask */
> +static inline unsigned int gpf_to_alloc_flags(gfp_t gfp_mask,
> +                                           unsigned int alloc_flags)
>  {
>  #ifdef CONFIG_CMA
> -     unsigned int pflags = current->flags;
> -
> -     if (!(pflags & PF_MEMALLOC_PIN) &&
> -         gfp_migratetype(gfp_mask) == MIGRATE_MOVABLE)
> +     if (gfp_migratetype(gfp_mask) == MIGRATE_MOVABLE)
>               alloc_flags |= ALLOC_CMA;
> -
>  #endif
>       return alloc_flags;
>  }
> @@ -4472,7 +4469,7 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
>       } else if (unlikely(rt_task(current)) && !in_interrupt())
>               alloc_flags |= ALLOC_HARDER;
>  
> -     alloc_flags = current_alloc_flags(gfp_mask, alloc_flags);
> +     alloc_flags = gpf_to_alloc_flags(gfp_mask, alloc_flags);
>  
>       return alloc_flags;
>  }
> @@ -4774,7 +4771,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int 
> order,
>  
>       reserve_flags = __gfp_pfmemalloc_flags(gfp_mask);
>       if (reserve_flags)
> -             alloc_flags = current_alloc_flags(gfp_mask, reserve_flags);
> +             alloc_flags = gpf_to_alloc_flags(gfp_mask, reserve_flags);
>  
>       /*
>        * Reset the nodemask and zonelist iterators if memory policies can be
> @@ -4943,7 +4940,7 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, 
> unsigned int order,
>       if (should_fail_alloc_page(gfp_mask, order))
>               return false;
>  
> -     *alloc_flags = current_alloc_flags(gfp_mask, *alloc_flags);
> +     *alloc_flags = gpf_to_alloc_flags(gfp_mask, *alloc_flags);

I have a question, what is the abbreviation of "gpf" in the function
name gpf_to_alloc_flags()?

It seems that this function still use gfp_mask, is this supposed
to be gfp (Get Free Page)?

Thanks,
Lecopzer

Reply via email to