Commit 92f09176 authored by David Hildenbrand's avatar David Hildenbrand Committed by Andrew Morton
Browse files

mm: rename PG_isolated to PG_movable_ops_isolated

Let's rename the flag to make it clearer where it applies (not folios
...).

While at it, define the flag only with CONFIG_MIGRATION.

Link: https://lkml.kernel.org/r/20250704102524.326966-22-david@redhat.com


Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
Reviewed-by: default avatarZi Yan <ziy@nvidia.com>
Reviewed-by: default avatarLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: default avatarHarry Yoo <harry.yoo@oracle.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: Byungchul Park <byungchul@sk.com>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Eugenio Pé rez <eperezma@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Gregory Price <gourry@gourry.net>
Cc: "Huang, Ying" <ying.huang@linux.alibaba.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Jerrin Shaji George <jerrin.shaji-george@broadcom.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Mathew Brost <matthew.brost@intel.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Peter Xu <peterx@redhat.com>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Rakie Kim <rakie.kim@sk.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: xu xin <xu.xin16@zte.com.cn>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 3d388584
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -167,10 +167,9 @@ enum pageflags {
	/* Remapped by swiotlb-xen. */
	PG_xen_remapped = PG_owner_priv_1,

	/* non-lru isolated movable page */
	PG_isolated = PG_reclaim,

#ifdef CONFIG_MIGRATION
	/* movable_ops page that is isolated for migration */
	PG_movable_ops_isolated = PG_reclaim,
	/* this is a movable_ops page (for selected typed pages only) */
	PG_movable_ops = PG_uptodate,
#endif
@@ -1126,8 +1125,6 @@ static inline bool folio_contain_hwpoisoned_page(struct folio *folio)

bool is_free_buddy_page(const struct page *page);

PAGEFLAG(Isolated, isolated, PF_ANY);

#ifdef CONFIG_MIGRATION
/*
 * This page is migratable through movable_ops (for selected typed pages
@@ -1147,9 +1144,18 @@ PAGEFLAG(Isolated, isolated, PF_ANY);
 */
TESTPAGEFLAG(MovableOps, movable_ops, PF_NO_TAIL);
SETPAGEFLAG(MovableOps, movable_ops, PF_NO_TAIL);
/*
 * A movable_ops page has this flag set while it is isolated for migration.
 * This flag primarily protects against concurrent migration attempts.
 *
 * Once migration ended (success or failure), the flag is cleared. The
 * flag is managed by the migration core.
 */
PAGEFLAG(MovableOpsIsolated, movable_ops_isolated, PF_NO_TAIL);
#else /* !CONFIG_MIGRATION */
TESTPAGEFLAG_FALSE(MovableOps, movable_ops);
SETPAGEFLAG_NOOP(MovableOps, movable_ops);
PAGEFLAG_FALSE(MovableOpsIsolated, movable_ops_isolated);
#endif /* CONFIG_MIGRATION */

/**
+1 −1
Original line number Diff line number Diff line
@@ -1051,7 +1051,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
		if (!PageLRU(page)) {
			/* Isolation code will deal with any races. */
			if (unlikely(page_has_movable_ops(page)) &&
					!PageIsolated(page)) {
			    !PageMovableOpsIsolated(page)) {
				if (locked) {
					unlock_page_lruvec_irqrestore(locked, flags);
					locked = NULL;
+7 −7
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ bool isolate_movable_ops_page(struct page *page, isolate_mode_t mode)
		goto out_putfolio;

	VM_WARN_ON_ONCE_PAGE(!page_has_movable_ops(page), page);
	if (PageIsolated(page))
	if (PageMovableOpsIsolated(page))
		goto out_no_isolated;

	mops = page_movable_ops(page);
@@ -146,8 +146,8 @@ bool isolate_movable_ops_page(struct page *page, isolate_mode_t mode)
		goto out_no_isolated;

	/* Driver shouldn't use the isolated flag */
	VM_WARN_ON_ONCE_PAGE(PageIsolated(page), page);
	SetPageIsolated(page);
	VM_WARN_ON_ONCE_PAGE(PageMovableOpsIsolated(page), page);
	SetPageMovableOpsIsolated(page);
	folio_unlock(folio);

	return true;
@@ -177,10 +177,10 @@ static void putback_movable_ops_page(struct page *page)
	struct folio *folio = page_folio(page);

	VM_WARN_ON_ONCE_PAGE(!page_has_movable_ops(page), page);
	VM_WARN_ON_ONCE_PAGE(!PageIsolated(page), page);
	VM_WARN_ON_ONCE_PAGE(!PageMovableOpsIsolated(page), page);
	folio_lock(folio);
	page_movable_ops(page)->putback_page(page);
	ClearPageIsolated(page);
	ClearPageMovableOpsIsolated(page);
	folio_unlock(folio);
	folio_put(folio);
}
@@ -218,10 +218,10 @@ static int migrate_movable_ops_page(struct page *dst, struct page *src,
	int rc = MIGRATEPAGE_SUCCESS;

	VM_WARN_ON_ONCE_PAGE(!page_has_movable_ops(src), src);
	VM_WARN_ON_ONCE_PAGE(!PageIsolated(src), src);
	VM_WARN_ON_ONCE_PAGE(!PageMovableOpsIsolated(src), src);
	rc = page_movable_ops(src)->migrate_page(dst, src, mode);
	if (rc == MIGRATEPAGE_SUCCESS)
		ClearPageIsolated(src);
		ClearPageMovableOpsIsolated(src);
	return rc;
}