[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABzRoyYU2yOuGQskCAG_gzKiQwR6uM9eAYqOOCoQj+Xv=r163A@mail.gmail.com>
Date: Wed, 13 Aug 2025 13:05:22 +0800
From: Lance Yang <lance.yang@...ux.dev>
To: David Hildenbrand <david@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linuxppc-dev@...ts.ozlabs.org, virtualization@...ts.linux.dev,
linux-fsdevel@...r.kernel.org, linux-aio@...ck.org,
linux-btrfs@...r.kernel.org, jfs-discussion@...ts.sourceforge.net,
Andrew Morton <akpm@...ux-foundation.org>, Madhavan Srinivasan <maddy@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>, Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Jerrin Shaji George <jerrin.shaji-george@...adcom.com>, Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>, Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Eugenio Pérez <eperezma@...hat.com>,
Alexander Viro <viro@...iv.linux.org.uk>, Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Benjamin LaHaise <bcrl@...ck.org>, Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>, Muchun Song <muchun.song@...ux.dev>,
Oscar Salvador <osalvador@...e.de>, Dave Kleikamp <shaggy@...nel.org>, Zi Yan <ziy@...dia.com>,
Matthew Brost <matthew.brost@...el.com>, Joshua Hahn <joshua.hahnjy@...il.com>,
Rakie Kim <rakie.kim@...com>, Byungchul Park <byungchul@...com>, Gregory Price <gourry@...rry.net>,
Ying Huang <ying.huang@...ux.alibaba.com>, Alistair Popple <apopple@...dia.com>,
Minchan Kim <minchan@...nel.org>, Sergey Senozhatsky <senozhatsky@...omium.org>
Subject: Re: [PATCH v1 1/2] mm/migrate: remove MIGRATEPAGE_UNMAP
On Mon, Aug 11, 2025 at 10:47 PM David Hildenbrand <david@...hat.com> wrote:
>
[...]
> +++ b/mm/migrate.c
> @@ -1176,16 +1176,6 @@ static int migrate_folio_unmap(new_folio_t get_new_folio,
> bool locked = false;
> bool dst_locked = false;
>
> - if (folio_ref_count(src) == 1) {
> - /* Folio was freed from under us. So we are done. */
> - folio_clear_active(src);
> - folio_clear_unevictable(src);
> - /* free_pages_prepare() will clear PG_isolated. */
> - list_del(&src->lru);
> - migrate_folio_done(src, reason);
> - return MIGRATEPAGE_SUCCESS;
> - }
> -
> dst = get_new_folio(src, private);
> if (!dst)
> return -ENOMEM;
> @@ -1275,7 +1265,7 @@ static int migrate_folio_unmap(new_folio_t get_new_folio,
>
> if (unlikely(page_has_movable_ops(&src->page))) {
> __migrate_folio_record(dst, old_page_state, anon_vma);
> - return MIGRATEPAGE_UNMAP;
> + return 0;
> }
>
> /*
> @@ -1305,7 +1295,7 @@ static int migrate_folio_unmap(new_folio_t get_new_folio,
>
> if (!folio_mapped(src)) {
> __migrate_folio_record(dst, old_page_state, anon_vma);
> - return MIGRATEPAGE_UNMAP;
> + return 0;
> }
>
> out:
> @@ -1848,14 +1838,28 @@ static int migrate_pages_batch(struct list_head *from,
> continue;
> }
>
> + /*
> + * If we are holding the last folio reference, the folio
> + * was freed from under us, so just drop our reference.
> + */
> + if (likely(!page_has_movable_ops(&folio->page)) &&
> + folio_ref_count(folio) == 1) {
> + folio_clear_active(folio);
> + folio_clear_unevictable(folio);
> + list_del(&folio->lru);
> + migrate_folio_done(folio, reason);
> + stats->nr_succeeded += nr_pages;
> + stats->nr_thp_succeeded += is_thp;
> + continue;
> + }
> +
It seems the reason parameter is no longer used within migrate_folio_unmap()
after this patch.
Perhaps it could be removed from the function's signature ;)
> rc = migrate_folio_unmap(get_new_folio, put_new_folio,
> private, folio, &dst, mode, reason,
> ret_folios);
Anyway, just a small thought. Feel free to add:
Reviewed-by: Lance Yang <lance.yang@...ux.dev>
Thanks,
Lance
Powered by blists - more mailing lists