Re: [PATCH] mm,page_alloc: apply gfp_allowed_mask before the first allocation attempt.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri 01-09-17 23:11:31, Tetsuo Handa wrote:
> We are by error initializing alloc_flags before gfp_allowed_mask is
> applied. Apply gfp_allowed_mask before initializing alloc_flags so that
> the first allocation attempt uses correct flags.

It would be worth noting that this will not matter in most cases,
actually when only the node reclaim is enabled we can misbehave because
NOFS request for PM paths would be ignored.

> Fixes: 9cd7555875bb09da ("mm, page_alloc: split alloc_pages_nodemask()")

AFAICS this patch hasn't changed the logic and it was broken since
83d4ca8148fd ("mm, page_alloc: move __GFP_HARDWALL modifications out of
the fastpath")

> Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
> Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
> Cc: Hillf Danton <hillf.zj@xxxxxxxxxxxxxxx>
> Cc: Vlastimil Babka <vbabka@xxxxxxx>
> Cc: Jesper Dangaard Brouer <brouer@xxxxxxxxxx>

Other than that this looks correct to me. 
Acked-by: Michal Hocko <mhocko@xxxxxxxx>

I wish we can finally get rid of gfp_allowed_mask. I have it on my todo
list but never got to it.

Thanks!

> ---
>  mm/page_alloc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 6dbc49e..a123dee 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -4179,10 +4179,11 @@ struct page *
>  {
>  	struct page *page;
>  	unsigned int alloc_flags = ALLOC_WMARK_LOW;
> -	gfp_t alloc_mask = gfp_mask; /* The gfp_t that was actually used for allocation */
> +	gfp_t alloc_mask; /* The gfp_t that was actually used for allocation */
>  	struct alloc_context ac = { };
>  
>  	gfp_mask &= gfp_allowed_mask;
> +	alloc_mask = gfp_mask;
>  	if (!prepare_alloc_pages(gfp_mask, order, preferred_nid, nodemask, &ac, &alloc_mask, &alloc_flags))
>  		return NULL;
>  
> -- 
> 1.8.3.1
> 

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux