linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/migrate: Continue to migrate for small pages
@ 2023-01-29  2:54 Chen Wandun
  2023-01-29  3:01 ` Huang, Ying
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Wandun @ 2023-01-29  2:54 UTC (permalink / raw)
  To: akpm, linux-mm, linux-kernel, ying.huang; +Cc: chenwandun

migrate_hugetlbs returns -ENOMEM when no enough huge page,
however maybe there are still free small pages, so continue
to migrate for small pages.

Signed-off-by: Chen Wandun <chenwandun@huawei.com>
---
 mm/migrate.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index b971edbf32fc..c9d0d2058036 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1939,7 +1939,12 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
 
 	rc_gather = migrate_hugetlbs(from, get_new_page, put_new_page, private,
 				     mode, reason, &stats, &ret_folios);
-	if (rc_gather < 0)
+	/* Maybe there are free small pages, continue to migrate.
+	 * Nowdays the only negtive return value of migrate_hugetlbs
+	 * is -ENOMEM, keep compatible for coming negtive return
+	 * value instead of ignore return value.
+	 */
+	if (rc_gather < 0 && rc_gather != -ENOMEM)
 		goto out;
 again:
 	nr_pages = 0;
-- 
2.25.1



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

* Re: [PATCH] mm/migrate: Continue to migrate for small pages
  2023-01-29  2:54 [PATCH] mm/migrate: Continue to migrate for small pages Chen Wandun
@ 2023-01-29  3:01 ` Huang, Ying
  2023-01-29  3:26   ` Chen Wandun
  0 siblings, 1 reply; 3+ messages in thread
From: Huang, Ying @ 2023-01-29  3:01 UTC (permalink / raw)
  To: Chen Wandun; +Cc: akpm, linux-mm, linux-kernel

Chen Wandun <chenwandun@huawei.com> writes:

> migrate_hugetlbs returns -ENOMEM when no enough huge page,
> however maybe there are still free small pages, so continue
> to migrate for small pages.

Better to replace "page" with "folio", and "small" with "non-hugetlb".

> Signed-off-by: Chen Wandun <chenwandun@huawei.com>
> ---
>  mm/migrate.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index b971edbf32fc..c9d0d2058036 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1939,7 +1939,12 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
>  
>  	rc_gather = migrate_hugetlbs(from, get_new_page, put_new_page, private,
>  				     mode, reason, &stats, &ret_folios);
> -	if (rc_gather < 0)
> +	/* Maybe there are free small pages, continue to migrate.

There may be free non-hugetlb folios available, continue to migrate.

> +	 * Nowdays the only negtive return value of migrate_hugetlbs
> +	 * is -ENOMEM, keep compatible for coming negtive return
> +	 * value instead of ignore return value.

This can be moved to patch description.

> +	 */
> +	if (rc_gather < 0 && rc_gather != -ENOMEM)
>  		goto out;
>  again:
>  	nr_pages = 0;

Best Regards,
Huang, Ying


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

* Re: [PATCH] mm/migrate: Continue to migrate for small pages
  2023-01-29  3:01 ` Huang, Ying
@ 2023-01-29  3:26   ` Chen Wandun
  0 siblings, 0 replies; 3+ messages in thread
From: Chen Wandun @ 2023-01-29  3:26 UTC (permalink / raw)
  To: Huang, Ying; +Cc: akpm, linux-mm, linux-kernel



On 2023/1/29 11:01, Huang, Ying wrote:
> Chen Wandun <chenwandun@huawei.com> writes:
>
>> migrate_hugetlbs returns -ENOMEM when no enough huge page,
>> however maybe there are still free small pages, so continue
>> to migrate for small pages.
> Better to replace "page" with "folio", and "small" with "non-hugetlb".
Will do.
>
>> Signed-off-by: Chen Wandun <chenwandun@huawei.com>
>> ---
>>   mm/migrate.c | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/mm/migrate.c b/mm/migrate.c
>> index b971edbf32fc..c9d0d2058036 100644
>> --- a/mm/migrate.c
>> +++ b/mm/migrate.c
>> @@ -1939,7 +1939,12 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
>>   
>>   	rc_gather = migrate_hugetlbs(from, get_new_page, put_new_page, private,
>>   				     mode, reason, &stats, &ret_folios);
>> -	if (rc_gather < 0)
>> +	/* Maybe there are free small pages, continue to migrate.
> There may be free non-hugetlb folios available, continue to migrate.
will do
>
>> +	 * Nowdays the only negtive return value of migrate_hugetlbs
>> +	 * is -ENOMEM, keep compatible for coming negtive return
>> +	 * value instead of ignore return value.
> This can be moved to patch description.
will do
thanks for your review.

Best Regards.
Wandun
>
>> +	 */
>> +	if (rc_gather < 0 && rc_gather != -ENOMEM)
>>   		goto out;
>>   again:
>>   	nr_pages = 0;
> Best Regards,
> Huang, Ying
> .



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

end of thread, other threads:[~2023-01-29  3:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-29  2:54 [PATCH] mm/migrate: Continue to migrate for small pages Chen Wandun
2023-01-29  3:01 ` Huang, Ying
2023-01-29  3:26   ` Chen Wandun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox