lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 31 Jan 2021 21:09:03 +0800
From:   Lecopzer Chen <lecopzer@...il.com>
To:     pasha.tatashin@...een.com
Cc:     akpm@...ux-foundation.org, dan.j.williams@...el.com,
        david@...hat.com, iamjoonsoo.kim@....com, ira.weiny@...el.com,
        jgg@...pe.ca, jhubbard@...dia.com, jmorris@...ei.org,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-kselftest@...r.kernel.org, linux-mm@...ck.org,
        mgorman@...e.de, mhocko@...e.com, mike.kravetz@...cle.com,
        mingo@...hat.com, osalvador@...e.de, peterz@...radead.org,
        rientjes@...gle.com, rostedt@...dmis.org, sashal@...nel.org,
        tyhicks@...ux.microsoft.com, vbabka@...e.cz, willy@...radead.org
Subject: Re: [PATCH v8 07/14] mm: honor PF_MEMALLOC_PIN for all movable pages


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ