From nobody Wed Oct 8 00:37:27 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 439A92FC3C9 for ; Fri, 4 Jul 2025 10:26:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751624794; cv=none; b=VlYT22TxIrotRgaR3wHzSPzZO3SxrCkktNoXZhLZKSGeOehmxptbRyctHlQeWCvXHiFpBiQwMnzcUFJ3VxhzpZMUbOm5cOWCQ5D+F2QS2rr0HDGgf2fSncBZt/ZnFVFbPCZUH4ep76YEgi8IQOL+mo4t9PDQnkYkmYcX8lBKuKc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751624794; c=relaxed/simple; bh=jqBiKE3ljFPLtpUV52bcJzPXSrwMCijt0l7mZnej4RU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aBULW5ucalseuu/scWLN1uKaJYvnIbOgXgD/ZV4UEGjFQTitaD9t6OzSw+jlT7+O+LQ0I2UVmX3shJ912dlebeIGVIYcp+BFWbTmPFu7LjAqqa9R+eOKYATnBB5OQgf1tfTGDROFugTwZ0/Gpa4g/UxBf9WChEab1zVEww3gsUc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JMfYfOfh; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JMfYfOfh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1751624791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oIfhqplW92Whs4rQ5a+bzpcvmYNnoFDclaHeGz5GfJE=; b=JMfYfOfhNVuRV1MugkJIuX9/kuuZAB/gpWi9jgYRhx6vYVxzzw8jhgd+amM6GzHJuWHS6o H45OCIAnk/qLYC+wJD8tAynrtBc8mBEn+ioWyfLV51t/MkozZvuuWg7nyVlEUV1W/cg2RZ 07Pl9WPIb7I0L+wVCXvIpEGDbgGbyKQ= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-252-a7P2cLmWMciLbKEmY2ykbw-1; Fri, 04 Jul 2025 06:26:30 -0400 X-MC-Unique: a7P2cLmWMciLbKEmY2ykbw-1 X-Mimecast-MFC-AGG-ID: a7P2cLmWMciLbKEmY2ykbw_1751624789 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-454acc74f22so5106355e9.2 for ; Fri, 04 Jul 2025 03:26:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751624789; x=1752229589; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oIfhqplW92Whs4rQ5a+bzpcvmYNnoFDclaHeGz5GfJE=; b=rpZSoJ6eNIyTWtnC39cLOimgkvi82Gwi6IcS5UNkSBMhygwPF2iSiMWJ7nlN+mdwfh 46Ewiz4wW3auNdYON9XwWhxPs0V2mCM1Y2+zZnM83fAPAC/FnywWLgDNra2aX2JY/sOo +UgK+XoXMN5+BcQGOopN6NOl6/EBHSXr2guodnxJjUqXCxcyy4Ro+O9DOLTVJnQkr5W8 HysaZJD7mdKYFQrEM9GgfK1ykgpvWSZT43ZU8qu2IffHG7MKZn8ZcqndJFEQ2XRqZYeC nkgSBZCLH91dUHREumZPNN3Ky7KfdGhxoWtfXdwQISZ5MAS6r2SxfFcHb0KUJXkfH9AP CveA== X-Gm-Message-State: AOJu0YxVj6kTomQ6YRjRzCwrcukh10qIEx8mSZsRKNezujDqDaYBgbxC 91CyeSF6HrLZBLFPSUQdSQRZt8tPkWLbIef7/QgC6725rgdNc/mmDkJdrYA/H29iFQ9xC0DwJ0R DiOMKn/q7UdBGIPMLGW0d+ZyZQFki4njp7GmvhT9Y4CAWi3qKdiob9Y8/6KuvcGTxQziz5Y+16d 2AvfnVQiTMsZCxLbFa2tAPzO2Wac5zxFMQA3XiGbKdBICXWA== X-Gm-Gg: ASbGncsKFzW28wRz0ozz3e8dyiMD81YGNuyPqQ6LRbiHgzZRd8dY/mqdIoiO/P3UOwP LTWyWmucmghWhn4fOW81dVhBr9n0jIdIzWjc1C5W2GABG69HbpieJNAU3sTLv7dQ0ypOJ/l0Zbv qOIw00P3KWTGJdTlLBANROGRY1xzRc1LgjCvVIkvtEdYLgFv4LTA5mpRuadVzOZ+yfGryC5JUiv p0k1ut9xmOFo8p2iVPKWnpSt6WbYw7mRPnlriqAwygtXmEu5CbN7rS45OQelo0Ra4SP9pVA6N/4 aCoSvZS4wU7hfUfS0e/SK60Ap0Hlz4AfHGOXQn/L66XotgMIytTQQbmZEsaSEt/i9INgkXMGonh 3TXs6Ig== X-Received: by 2002:a05:6000:3ce:b0:3b2:ef53:5818 with SMTP id ffacd0b85a97d-3b4964eb1dfmr1524574f8f.5.1751624788992; Fri, 04 Jul 2025 03:26:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6/dh0H9/LpgMHN6+E5K8aCm2QgibuKB8jFRjnybENn7lard2NaLBEO46u6eT1pnDUCzj4ag== X-Received: by 2002:a05:6000:3ce:b0:3b2:ef53:5818 with SMTP id ffacd0b85a97d-3b4964eb1dfmr1524493f8f.5.1751624788372; Fri, 04 Jul 2025 03:26:28 -0700 (PDT) Received: from localhost (p200300d82f2c5500098823f9faa07232.dip0.t-ipconnect.de. [2003:d8:2f2c:5500:988:23f9:faa0:7232]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-454a9bde954sm50967885e9.33.2025.07.04.03.26.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Jul 2025 03:26:27 -0700 (PDT) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux.dev, linux-fsdevel@vger.kernel.org, David Hildenbrand , Andrew Morton , Jonathan Corbet , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Jerrin Shaji George , Arnd Bergmann , Greg Kroah-Hartman , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , Alexander Viro , Christian Brauner , Jan Kara , Zi Yan , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , "Matthew Wilcox (Oracle)" , Minchan Kim , Sergey Senozhatsky , Brendan Jackman , Johannes Weiner , Jason Gunthorpe , John Hubbard , Peter Xu , Xu Xin , Chengming Zhou , Miaohe Lin , Naoya Horiguchi , Oscar Salvador , Rik van Riel , Harry Yoo , Qi Zheng , Shakeel Butt Subject: [PATCH v2 21/29] mm: rename PG_isolated to PG_movable_ops_isolated Date: Fri, 4 Jul 2025 12:25:15 +0200 Message-ID: <20250704102524.326966-22-david@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250704102524.326966-1-david@redhat.com> References: <20250704102524.326966-1-david@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Let's rename the flag to make it clearer where it applies (not folios ...). While at it, define the flag only with CONFIG_MIGRATION. Reviewed-by: Zi Yan Reviewed-by: Lorenzo Stoakes Reviewed-by: Harry Yoo Signed-off-by: David Hildenbrand --- include/linux/page-flags.h | 16 +++++++++++----- mm/compaction.c | 2 +- mm/migrate.c | 14 +++++++------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 5f2b570735852..8b0e5c7371e67 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -167,10 +167,9 @@ enum pageflags { /* Remapped by swiotlb-xen. */ PG_xen_remapped =3D PG_owner_priv_1, =20 - /* non-lru isolated movable page */ - PG_isolated =3D PG_reclaim, - #ifdef CONFIG_MIGRATION + /* movable_ops page that is isolated for migration */ + PG_movable_ops_isolated =3D PG_reclaim, /* this is a movable_ops page (for selected typed pages only) */ PG_movable_ops =3D PG_uptodate, #endif @@ -1126,8 +1125,6 @@ static inline bool folio_contain_hwpoisoned_page(stru= ct folio *folio) =20 bool is_free_buddy_page(const struct page *page); =20 -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 */ =20 /** diff --git a/mm/compaction.c b/mm/compaction.c index 349f4ea0ec3e5..bf021b31c7ece 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -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 =3D NULL; diff --git a/mm/migrate.c b/mm/migrate.c index fde6221562399..7fd3d38410c42 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -135,7 +135,7 @@ bool isolate_movable_ops_page(struct page *page, isolat= e_mode_t mode) goto out_putfolio; =20 VM_WARN_ON_ONCE_PAGE(!page_has_movable_ops(page), page); - if (PageIsolated(page)) + if (PageMovableOpsIsolated(page)) goto out_no_isolated; =20 mops =3D page_movable_ops(page); @@ -146,8 +146,8 @@ bool isolate_movable_ops_page(struct page *page, isolat= e_mode_t mode) goto out_no_isolated; =20 /* 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); =20 return true; @@ -177,10 +177,10 @@ static void putback_movable_ops_page(struct page *pag= e) struct folio *folio =3D page_folio(page); =20 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); } @@ -216,10 +216,10 @@ static int migrate_movable_ops_page(struct page *dst,= struct page *src, int rc =3D MIGRATEPAGE_SUCCESS; =20 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 =3D page_movable_ops(src)->migrate_page(dst, src, mode); if (rc =3D=3D MIGRATEPAGE_SUCCESS) - ClearPageIsolated(src); + ClearPageMovableOpsIsolated(src); return rc; } =20 --=20 2.49.0