linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_alloc: reduce fallbacks to (MIGRATE_PCPTYPES - 1)
@ 2023-02-03 10:01 Yajun Deng
  2023-02-03 22:23 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Yajun Deng @ 2023-02-03 10:01 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, Yajun Deng

The commit 1dd214b8f21c ("mm: page_alloc: avoid merging non-fallbackable
pageblocks with others") has removed MIGRATE_CMA and MIGRATE_ISOLATE from
fallbacks list. so there is no need to add an element at the end of every
type.

Reduce fallbacks to (MIGRATE_PCPTYPES - 1).

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
 mm/page_alloc.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5ebce58026f1..21d820c42900 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2603,10 +2603,10 @@ struct page *__rmqueue_smallest(struct zone *zone, unsigned int order,
  *
  * The other migratetypes do not have fallbacks.
  */
-static int fallbacks[MIGRATE_TYPES][3] = {
-	[MIGRATE_UNMOVABLE]   = { MIGRATE_RECLAIMABLE, MIGRATE_MOVABLE,   MIGRATE_TYPES },
-	[MIGRATE_MOVABLE]     = { MIGRATE_RECLAIMABLE, MIGRATE_UNMOVABLE, MIGRATE_TYPES },
-	[MIGRATE_RECLAIMABLE] = { MIGRATE_UNMOVABLE,   MIGRATE_MOVABLE,   MIGRATE_TYPES },
+static int fallbacks[MIGRATE_TYPES][MIGRATE_PCPTYPES - 1] = {
+	[MIGRATE_UNMOVABLE]   = { MIGRATE_RECLAIMABLE, MIGRATE_MOVABLE   },
+	[MIGRATE_MOVABLE]     = { MIGRATE_RECLAIMABLE, MIGRATE_UNMOVABLE },
+	[MIGRATE_RECLAIMABLE] = { MIGRATE_UNMOVABLE,   MIGRATE_MOVABLE   },
 };
 
 #ifdef CONFIG_CMA
@@ -2865,11 +2865,8 @@ int find_suitable_fallback(struct free_area *area, unsigned int order,
 		return -1;
 
 	*can_steal = false;
-	for (i = 0;; i++) {
+	for (i = 0; i < MIGRATE_PCPTYPES - 1 ; i++) {
 		fallback_mt = fallbacks[migratetype][i];
-		if (fallback_mt == MIGRATE_TYPES)
-			break;
-
 		if (free_area_empty(area, fallback_mt))
 			continue;
 
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/page_alloc: reduce fallbacks to (MIGRATE_PCPTYPES - 1)
  2023-02-03 10:01 [PATCH] mm/page_alloc: reduce fallbacks to (MIGRATE_PCPTYPES - 1) Yajun Deng
@ 2023-02-03 22:23 ` Andrew Morton
  2023-02-08 16:07   ` Vlastimil Babka
  2023-02-09  2:02   ` Yajun Deng
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Morton @ 2023-02-03 22:23 UTC (permalink / raw)
  To: Yajun Deng
  Cc: linux-mm, linux-kernel, Zi Yan, Mel Gorman, David Hildenbrand,
	Vlastimil Babka, Acked-by

On Fri,  3 Feb 2023 18:01:32 +0800 Yajun Deng <yajun.deng@linux.dev> wrote:

> The commit 1dd214b8f21c ("mm: page_alloc: avoid merging non-fallbackable
> pageblocks with others") has removed MIGRATE_CMA and MIGRATE_ISOLATE from
> fallbacks list. so there is no need to add an element at the end of every
> type.
> 
> Reduce fallbacks to (MIGRATE_PCPTYPES - 1).

Thanks.  `git log' suggests who should be cc'ed when fixing things...

> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2603,10 +2603,10 @@ struct page *__rmqueue_smallest(struct zone *zone, unsigned int order,
>   *
>   * The other migratetypes do not have fallbacks.
>   */
> -static int fallbacks[MIGRATE_TYPES][3] = {
> -	[MIGRATE_UNMOVABLE]   = { MIGRATE_RECLAIMABLE, MIGRATE_MOVABLE,   MIGRATE_TYPES },
> -	[MIGRATE_MOVABLE]     = { MIGRATE_RECLAIMABLE, MIGRATE_UNMOVABLE, MIGRATE_TYPES },
> -	[MIGRATE_RECLAIMABLE] = { MIGRATE_UNMOVABLE,   MIGRATE_MOVABLE,   MIGRATE_TYPES },
> +static int fallbacks[MIGRATE_TYPES][MIGRATE_PCPTYPES - 1] = {
> +	[MIGRATE_UNMOVABLE]   = { MIGRATE_RECLAIMABLE, MIGRATE_MOVABLE   },
> +	[MIGRATE_MOVABLE]     = { MIGRATE_RECLAIMABLE, MIGRATE_UNMOVABLE },
> +	[MIGRATE_RECLAIMABLE] = { MIGRATE_UNMOVABLE,   MIGRATE_MOVABLE   },
>  };
>  
>  #ifdef CONFIG_CMA
> @@ -2865,11 +2865,8 @@ int find_suitable_fallback(struct free_area *area, unsigned int order,
>  		return -1;
>  
>  	*can_steal = false;
> -	for (i = 0;; i++) {
> +	for (i = 0; i < MIGRATE_PCPTYPES - 1 ; i++) {
>  		fallback_mt = fallbacks[migratetype][i];
> -		if (fallback_mt == MIGRATE_TYPES)
> -			break;
> -
>  		if (free_area_empty(area, fallback_mt))
>  			continue;
>  
> -- 
> 2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/page_alloc: reduce fallbacks to (MIGRATE_PCPTYPES - 1)
  2023-02-03 22:23 ` Andrew Morton
@ 2023-02-08 16:07   ` Vlastimil Babka
  2023-02-09  2:02   ` Yajun Deng
  1 sibling, 0 replies; 4+ messages in thread
From: Vlastimil Babka @ 2023-02-08 16:07 UTC (permalink / raw)
  To: Andrew Morton, Yajun Deng
  Cc: linux-mm, linux-kernel, Zi Yan, Mel Gorman, David Hildenbrand,
	Mike Rapoport, Oscar Salvador

On 2/3/23 23:23, Andrew Morton wrote:
> On Fri,  3 Feb 2023 18:01:32 +0800 Yajun Deng <yajun.deng@linux.dev> wrote:
> 
>> The commit 1dd214b8f21c ("mm: page_alloc: avoid merging non-fallbackable
>> pageblocks with others") has removed MIGRATE_CMA and MIGRATE_ISOLATE from
>> fallbacks list. so there is no need to add an element at the end of every
>> type.
>> 
>> Reduce fallbacks to (MIGRATE_PCPTYPES - 1).


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

> Thanks.  `git log' suggests who should be cc'ed when fixing things...
> 
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -2603,10 +2603,10 @@ struct page *__rmqueue_smallest(struct zone *zone, unsigned int order,
>>   *
>>   * The other migratetypes do not have fallbacks.
>>   */
>> -static int fallbacks[MIGRATE_TYPES][3] = {
>> -	[MIGRATE_UNMOVABLE]   = { MIGRATE_RECLAIMABLE, MIGRATE_MOVABLE,   MIGRATE_TYPES },
>> -	[MIGRATE_MOVABLE]     = { MIGRATE_RECLAIMABLE, MIGRATE_UNMOVABLE, MIGRATE_TYPES },
>> -	[MIGRATE_RECLAIMABLE] = { MIGRATE_UNMOVABLE,   MIGRATE_MOVABLE,   MIGRATE_TYPES },
>> +static int fallbacks[MIGRATE_TYPES][MIGRATE_PCPTYPES - 1] = {

Why not also reduce the first index size from [MIGRATE_TYPES] to
[MIGRATE_PCPTYPES] ?

>> +	[MIGRATE_UNMOVABLE]   = { MIGRATE_RECLAIMABLE, MIGRATE_MOVABLE   },
>> +	[MIGRATE_MOVABLE]     = { MIGRATE_RECLAIMABLE, MIGRATE_UNMOVABLE },
>> +	[MIGRATE_RECLAIMABLE] = { MIGRATE_UNMOVABLE,   MIGRATE_MOVABLE   },
>>  };
>>  
>>  #ifdef CONFIG_CMA
>> @@ -2865,11 +2865,8 @@ int find_suitable_fallback(struct free_area *area, unsigned int order,
>>  		return -1;
>>  
>>  	*can_steal = false;
>> -	for (i = 0;; i++) {
>> +	for (i = 0; i < MIGRATE_PCPTYPES - 1 ; i++) {
>>  		fallback_mt = fallbacks[migratetype][i];
>> -		if (fallback_mt == MIGRATE_TYPES)
>> -			break;
>> -
>>  		if (free_area_empty(area, fallback_mt))
>>  			continue;
>>  
>> -- 
>> 2.25.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/page_alloc: reduce fallbacks to (MIGRATE_PCPTYPES - 1)
  2023-02-03 22:23 ` Andrew Morton
  2023-02-08 16:07   ` Vlastimil Babka
@ 2023-02-09  2:02   ` Yajun Deng
  1 sibling, 0 replies; 4+ messages in thread
From: Yajun Deng @ 2023-02-09  2:02 UTC (permalink / raw)
  To: Vlastimil Babka, Andrew Morton
  Cc: linux-mm, linux-kernel, Zi Yan, Mel Gorman, David Hildenbrand,
	Mike Rapoport, Oscar Salvador

February 9, 2023 12:07 AM, "Vlastimil Babka" <vbabka@suse.cz> wrote:

> On 2/3/23 23:23, Andrew Morton wrote:
> 
>> On Fri, 3 Feb 2023 18:01:32 +0800 Yajun Deng <yajun.deng@linux.dev> wrote:
>> 
>>> The commit 1dd214b8f21c ("mm: page_alloc: avoid merging non-fallbackable
>>> pageblocks with others") has removed MIGRATE_CMA and MIGRATE_ISOLATE from
>>> fallbacks list. so there is no need to add an element at the end of every
>>> type.
>>> 
>>> Reduce fallbacks to (MIGRATE_PCPTYPES - 1).
> 
> Acked-by: Vlastimil Babka <vbabka@suse.cz>
> 
>> Thanks. `git log' suggests who should be cc'ed when fixing things...
>> 
>>> --- a/mm/page_alloc.c
>>> +++ b/mm/page_alloc.c
>>> @@ -2603,10 +2603,10 @@ struct page *__rmqueue_smallest(struct zone *zone, unsigned int order,
>>> *
>>> * The other migratetypes do not have fallbacks.
>>> */
>>> -static int fallbacks[MIGRATE_TYPES][3] = {
>>> - [MIGRATE_UNMOVABLE] = { MIGRATE_RECLAIMABLE, MIGRATE_MOVABLE, MIGRATE_TYPES },
>>> - [MIGRATE_MOVABLE] = { MIGRATE_RECLAIMABLE, MIGRATE_UNMOVABLE, MIGRATE_TYPES },
>>> - [MIGRATE_RECLAIMABLE] = { MIGRATE_UNMOVABLE, MIGRATE_MOVABLE, MIGRATE_TYPES },
>>> +static int fallbacks[MIGRATE_TYPES][MIGRATE_PCPTYPES - 1] = {
> 
> Why not also reduce the first index size from [MIGRATE_TYPES] to
> [MIGRATE_PCPTYPES] ?
> 

I overlooked this. I'll do it in the next patch.

>>> + [MIGRATE_UNMOVABLE] = { MIGRATE_RECLAIMABLE, MIGRATE_MOVABLE },
>>> + [MIGRATE_MOVABLE] = { MIGRATE_RECLAIMABLE, MIGRATE_UNMOVABLE },
>>> + [MIGRATE_RECLAIMABLE] = { MIGRATE_UNMOVABLE, MIGRATE_MOVABLE },
>>> };
>>> 
>>> #ifdef CONFIG_CMA
>>> @@ -2865,11 +2865,8 @@ int find_suitable_fallback(struct free_area *area, unsigned int order,
>>> return -1;
>>> 
>>> *can_steal = false;
>>> - for (i = 0;; i++) {
>>> + for (i = 0; i < MIGRATE_PCPTYPES - 1 ; i++) {
>>> fallback_mt = fallbacks[migratetype][i];
>>> - if (fallback_mt == MIGRATE_TYPES)
>>> - break;
>>> -
>>> if (free_area_empty(area, fallback_mt))
>>> continue;
>>> 
>>> --
>>> 2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-09  2:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-03 10:01 [PATCH] mm/page_alloc: reduce fallbacks to (MIGRATE_PCPTYPES - 1) Yajun Deng
2023-02-03 22:23 ` Andrew Morton
2023-02-08 16:07   ` Vlastimil Babka
2023-02-09  2:02   ` Yajun Deng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).