Re: [PATCH 3/8] migrate_pages: restrict number of pages to migrate in batch

Huang, Ying
2023-01-04T00:26:22Z

Zi Yan <ziy@nvidia.com> writes:

> On 26 Dec 2022, at 19:28, Huang Ying wrote:

[snip]

>> +/*
>> + * migrate_pages - migrate the folios specified in a list, to the free folios
>> + * supplied as the target for the page migration
>> + *
>> + * @from: The list of folios to be migrated.
>> + * @get_new_page: The function used to allocate free folios to be used
>> + * as the target of the folio migration.
>> + * @put_new_page: The function used to free target folios if migration
>> + * fails, or NULL if no special handling is necessary.
>> + * @private: Private data to be passed on to get_new_page()
>> + * @mode: The migration mode that specifies the constraints for
>> + * folio migration, if any.
>> + * @reason: The reason for folio migration.
>> + * @ret_succeeded: Set to the number of folios migrated successfully if
>> + * the caller passes a non-NULL pointer.
>> + *
>> + * The function returns after 10 attempts or if no folios are movable any more
>> + * because the list has become empty or no retryable folios exist any more.
>> + * It is caller's responsibility to call putback_movable_pages() to return folios
>> + * to the LRU or free list only if ret != 0.
>> + *
>> + * Returns the number of {normal folio, large folio, hugetlb} that were not
>> + * migrated, or an error code. The number of large folio splits will be
>> + * considered as the number of non-migrated large folio, no matter how many
>> + * split folios of the large folio are migrated successfully.
>> + */
>> +int migrate_pages(struct list_head *from, new_page_t get_new_page,
>> + free_page_t put_new_page, unsigned long private,
>> + enum migrate_mode mode, int reason, unsigned int *ret_succeeded)
>> +{
>> + int rc, rc_gether;
>
> rc_gether -> rc_gather?

Good catch! Thanks! Will change this in the next version.

Best Regards,
Huang, Ying

>> + int nr_pages;
>> + struct folio *folio, *folio2;
>> + LIST_HEAD(folios);
>> + LIST_HEAD(ret_folios);
>> + struct migrate_pages_stats stats;
>> +

[snip]