diff mbox series

mm/page_alloc: only search higher order when fallback

Message ID 20220803025121.47018-1-wuyun.abel@bytedance.com (mailing list archive)
State New
Headers show
Series mm/page_alloc: only search higher order when fallback | expand

Commit Message

Abel Wu Aug. 3, 2022, 2:51 a.m. UTC
It seems unnecessary to search pages with order < alloc_order in
fallback allocation.

Signed-off-by: Abel Wu <wuyun.abel@bytedance.com>
---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Vlastimil Babka Aug. 3, 2022, 8:15 a.m. UTC | #1
On 8/3/22 04:51, Abel Wu wrote:
> It seems unnecessary to search pages with order < alloc_order in
> fallback allocation.

This can currently happen with ALLOC_NOFRAGMENT and alloc_order >
pageblock_order, so add a test to prevent it.

> Signed-off-by: Abel Wu <wuyun.abel@bytedance.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>  mm/page_alloc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index e008a3df0485..0abafc2fc3e0 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2934,7 +2934,7 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype,
>  	 * i.e. orders < pageblock_order. If there are no local zones free,
>  	 * the zonelists will be reiterated without ALLOC_NOFRAGMENT.
>  	 */
> -	if (alloc_flags & ALLOC_NOFRAGMENT)
> +	if (order < pageblock_order && alloc_flags & ALLOC_NOFRAGMENT)
>  		min_order = pageblock_order;
>  
>  	/*
Muchun Song Aug. 4, 2022, 5:36 a.m. UTC | #2
On Wed, Aug 3, 2022 at 10:51 AM Abel Wu <wuyun.abel@bytedance.com> wrote:
>
> It seems unnecessary to search pages with order < alloc_order in
> fallback allocation.
>
> Signed-off-by: Abel Wu <wuyun.abel@bytedance.com>

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

Thanks.
Mel Gorman Aug. 4, 2022, 9:39 a.m. UTC | #3
On Wed, Aug 03, 2022 at 10:51:21AM +0800, Abel Wu wrote:
> It seems unnecessary to search pages with order < alloc_order in
> fallback allocation.
> 
> Signed-off-by: Abel Wu <wuyun.abel@bytedance.com>

Acked-by: Mel Gorman <mgorman@techsingularity.net>
diff mbox series

Patch

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e008a3df0485..0abafc2fc3e0 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2934,7 +2934,7 @@  __rmqueue_fallback(struct zone *zone, int order, int start_migratetype,
 	 * i.e. orders < pageblock_order. If there are no local zones free,
 	 * the zonelists will be reiterated without ALLOC_NOFRAGMENT.
 	 */
-	if (alloc_flags & ALLOC_NOFRAGMENT)
+	if (order < pageblock_order && alloc_flags & ALLOC_NOFRAGMENT)
 		min_order = pageblock_order;
 
 	/*