Re: [PATCH -v2 0/9] migrate_pages(): batch TLB flushing

From: Mike Kravetz
Date: Thu Jan 12 2023 - 23:51:29 EST


On 01/13/23 10:42, Huang, Ying wrote:
> Mike Kravetz <mike.kravetz@xxxxxxxxxx> writes:
> > On 01/12/23 15:17, Huang, Ying wrote:
> >> Mike Kravetz <mike.kravetz@xxxxxxxxxx> writes:
> >> > On 01/12/23 08:09, Huang, Ying wrote:
> >
> > Isolated to patch,
> > [PATCH -v2 4/9] migrate_pages: split unmap_and_move() to _unmap() and _move()
> >
> > Actually, recreated/isolated by just applying this series to v6.2-rc3 in an
> > effort to eliminate any possible noise in linux-next.
> >
> > Spent a little time looking at modifications made there, but nothing stood out.
> > Will investigate more as time allows.
>
> Thank you very much! That's really helpful.
>
> Checked that patch again, found that there's an issue about non-lru
> pages. Do you enable zram in your test system? Can you try the
> below debug patch on top of

CONFIG_ZRAM=y

>
> [PATCH -v2 4/9] migrate_pages: split unmap_and_move() to _unmap() and _move()
>
> The following patches in series need to be rebased for the below
> change. I will test with zram enabled too.

A quick test with below patch on top of [PATCH -v2 4/9] (without the rest of
the series applied) makes the issue go away. Thanks!
--
Mike Kravetz

>
> Best Regards,
> Huang, Ying
>
> ---------------------------8<------------------------------------------------------
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 4c35c2a49574..7153d954b8a2 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1187,10 +1187,13 @@ static int __migrate_folio_move(struct folio *src, struct folio *dst,
> int rc;
> int page_was_mapped = 0;
> struct anon_vma *anon_vma = NULL;
> + bool is_lru = !__PageMovable(&src->page);
>
> __migrate_folio_extract(dst, &page_was_mapped, &anon_vma);
>
> rc = move_to_new_folio(dst, src, mode);
> + if (!unlikely(is_lru))
> + goto out_unlock_both;
>
> /*
> * When successful, push dst to LRU immediately: so that if it
> @@ -1211,6 +1214,7 @@ static int __migrate_folio_move(struct folio *src, struct folio *dst,
> remove_migration_ptes(src,
> rc == MIGRATEPAGE_SUCCESS ? dst : src, false);
>
> +out_unlock_both:
> folio_unlock(dst);
> /* Drop an anon_vma reference if we took one */
> if (anon_vma)