Hi, Zhenneng,
Zhenneng Li writes:
> We restrict the number of pages to be migrated to no more than
> HPAGE_PMD_NR or NR_MAX_BATCHED_MIGRATION, but in fact, the
> number of pages to be migrated may reach 2*HPAGE_PMD_NR-1 or 2
> *NR_MAX_BATCHED_MIGRATION-1, it's not in inconsistent with the context.
Yes. It's not HPAGE_PMD_NR exactly.
> Please refer to the patch: 42012e0436d4(migrate_pages: restrict number
> of pages to migrate in batch)
>
> Signed-off-by: Zhenneng Li
> ---
> mm/migrate.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 781979567f64..7a4b37aac9e8 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1961,7 +1961,7 @@ int migrate_pages(struct list_head *from, new_folio_t get_new_folio,
> break;
> }
> if (nr_pages >= NR_MAX_BATCHED_MIGRATION)
> - list_cut_before(&folios, from, &folio2->lru);
> + list_cut_before(&folios, from, &folio->lru);
If the first entry of the list "from" is a THP with size HPAGE_PMD_NR,
"folio" will be the first entry of from, so that "folios" will be empty.
Right?
Zhenneng Li writes:
> We restrict the number of pages to be migrated to no more than
> HPAGE_PMD_NR or NR_MAX_BATCHED_MIGRATION, but in fact, the
> number of pages to be migrated may reach 2*HPAGE_PMD_NR-1 or 2
> *NR_MAX_BATCHED_MIGRATION-1, it's not in inconsistent with the context.
Yes. It's not HPAGE_PMD_NR exactly.
> Please refer to the patch: 42012e0436d4(migrate_pages: restrict number
> of pages to migrate in batch)
>
> Signed-off-by: Zhenneng Li
> ---
> mm/migrate.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 781979567f64..7a4b37aac9e8 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1961,7 +1961,7 @@ int migrate_pages(struct list_head *from, new_folio_t get_new_folio,
> break;
> }
> if (nr_pages >= NR_MAX_BATCHED_MIGRATION)
> - list_cut_before(&folios, from, &folio2->lru);
> + list_cut_before(&folios, from, &folio->lru);
If the first entry of the list "from" is a THP with size HPAGE_PMD_NR,
"folio" will be the first entry of from, so that "folios" will be empty.
Right?