From mboxrd@z Thu Jan 1 00:00:00 1970 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 88B6128A738 for ; Mon, 30 Jun 2025 13:00:25 +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=1751288427; cv=none; b=JoT7UdlugG6igu55uOb1Ib2oG4z584SZRzp8nSl/sxihVtXd6mvTTiOYBwSNovpQna9/fWuVaWREX/9q4l9XWVZNL2FkG9qbpUe32q38Kir5YJURJcHEcSW0aTSuelpoHd2tZuPlNBox0lr3DdGASHy+giXJyZbNRB4ujl2a1oo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751288427; c=relaxed/simple; bh=eDj8cHxhN1KzXcdGn1TZtgX9KNukCFTUSaK0zNVfr+Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=tv1ZTx7rlbLQU87b5mG6mXDZZ7lEz0PBYrSUZ1h8Ovy89oBZWUHr3SIgZAKz1gntofUBARHvdAZkDCDJ7T5jDe2VVLmh3LrZWVNG6lFuFttk7FJw/89X5svJiWYPeahu6yyrXTeg1VNMwH89dfWxuJGSy98IMpV219odcu3h4Ho= 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=hG5HPiTB; 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="hG5HPiTB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1751288424; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vfJnfBkXpkPuvL/9X/X6rRos3axIFOlRbKihQ7zrqmc=; b=hG5HPiTB/I4imysz4BqsZyLI90lJ2psKldJpj7rBycFcc8b4cEw5UZJEhBdECKypXpriO0 5DliR7EC3QbR+Kfe3JoG+nmL350KmPJVhPeSvjoDwdSGQF4qbx5Wh5m1XTM97i8IzUcefn QX6LHjd/r5IUAoZdU8XdBvFnhik1gEw= 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-170-aPeJMm9iOsiGZsMFBPd4PQ-1; Mon, 30 Jun 2025 09:00:21 -0400 X-MC-Unique: aPeJMm9iOsiGZsMFBPd4PQ-1 X-Mimecast-MFC-AGG-ID: aPeJMm9iOsiGZsMFBPd4PQ_1751288415 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-45311704d22so14908715e9.2 for ; Mon, 30 Jun 2025 06:00:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751288415; x=1751893215; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vfJnfBkXpkPuvL/9X/X6rRos3axIFOlRbKihQ7zrqmc=; b=L1x4wRbT/HRQ7fJegeHl5iRIhQIag9hgHCgPJpGLhbS76dLPVoKSWR2BoPwgZnjgv2 Y4MdSIqTjb+gXW879Gk57dpm4NvA4eckhK0QUVMIVfUBEFJveujMrLrX7EK9fgJbpWPP 8HrTV2IIt+M6kwHLBmklq+SA2u4FnJI4e2DcaG/qTb2wa8tK2jmyAkGT7Rr9Fzjrh48B w808PAY/hqXI9xQO/l+7A8qZgx/w8u9B+2M/PTd1eVnz0qhPKTb7ENsQOGFLzlTDDhR+ n9npXHspC8sGfWiSzfC7DLJ55a1maViT9grgObda74Q+hg1y+79RL4mcpE4TroiiJstf wdAw== X-Forwarded-Encrypted: i=1; AJvYcCUBOCPDo3OwSGAEfmzFYXoLHo94e/FTClQYDX4ctcJyWV0KvgIxhtuRYU9CH32hT+IpIjS73Cf1ZgY=@vger.kernel.org X-Gm-Message-State: AOJu0Yx77AvVtyYca3DTKBYhWICYl2KhBg/aZXgjnwgjS0/1XpVhhhZX J3+RREVoRSgAhrTjfK9/ewI3aZ9RjmAXv4zdM7AJsfV5FndK+Zp5IRid/n1ZZWdB0OTb0OH3l06 j3vnNlA35YxiWtpoXOtHfSIoY99NWvkYmLofS3wt1AmGFtlv6lKh1Utsrw+BZ8A== X-Gm-Gg: ASbGncsz53C7u26VhS8Wqk4hVRlOYUs5ylDoQQ6APK1NMIjegu2GMKzk3AW/yVwfg3Z oZ5KTv2Znu6tiF7PiSYgW/YFYUCBARJij7TW7o4o/vBZ8qsqVyINw3oknLZepr03LSCqaa58aXL n+PyBeXicfnhiPJ/3fuN3P+WPndB1PJgJHdlFAdmujCeORG/8gwmrI1ECfkhxLfp4J4t1G6LIuN z3NX0QQ28o8bwVNcuc/J/+z7y25WU3n/GCiagupB/O+wXQAC6JUQ0m38IGbj6T65cCADO4nHyH8 nwZs6SK4zT0CIjAKQ7FbmT+k9g04Ipft5N7VO+eLi1ihIoFuE+WIPqrdh9PEhRNkm2p2VOrvLtn 9byuK6KY= X-Received: by 2002:a05:600c:3f0e:b0:43d:82c:2b11 with SMTP id 5b1f17b1804b1-4538ee6fc79mr120597155e9.23.1751288414949; Mon, 30 Jun 2025 06:00:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9Y6zMVNRx8SyemplqzZ+r/tVyw00Oe4g4/JGEqtvy2G6LpOQKRmzj2nzxeHUR41ZrxoqB6w== X-Received: by 2002:a05:600c:3f0e:b0:43d:82c:2b11 with SMTP id 5b1f17b1804b1-4538ee6fc79mr120596525e9.23.1751288414400; Mon, 30 Jun 2025 06:00:14 -0700 (PDT) Received: from localhost (p200300d82f40b30053f7d260aff47256.dip0.t-ipconnect.de. [2003:d8:2f40:b300:53f7:d260:aff4:7256]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3a892e59659sm10376300f8f.77.2025.06.30.06.00.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Jun 2025 06:00:13 -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 v1 00/29] mm/migration: rework movable_ops page migration (part 1) Date: Mon, 30 Jun 2025 14:59:41 +0200 Message-ID: <20250630130011.330477-1-david@redhat.com> X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on mm/mm-new. In the future, as we decouple "struct page" from "struct folio", pages that support "non-lru page migration" -- movable_ops page migration such as memory balloons and zsmalloc -- will no longer be folios. They will not have ->mapping, ->lru, and likely no refcount and no page lock. But they will have a type and flags :) This is the first part (other parts not written yet) of decoupling movable_ops page migration from folio migration. In this series, we get rid of the ->mapping usage, and start cleaning up the code + separating it from folio migration. Migration core will have to be further reworked to not treat movable_ops pages like folios. This is the first step into that direction. Heavily tested with virtio-balloon and lightly tested with zsmalloc on x86-64. Cross-compile-tested. RFC -> v1: * Some smaller fixups + comment changes + subject/description updates * Added ACKs/RBs (hope I didn't miss any) * "mm/migrate: move movable_ops page handling out of move_to_new_folio()" -> Fix goto out; vs goto out_unlock_both; * "mm: remove __folio_test_movable()" -> Fix page_has_movable_ops() checking wrong page Cc: Andrew Morton Cc: Jonathan Corbet Cc: Madhavan Srinivasan Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Jerrin Shaji George Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: "Michael S. Tsirkin" Cc: David Hildenbrand Cc: Jason Wang Cc: Xuan Zhuo Cc: "Eugenio Pérez" Cc: Alexander Viro Cc: Christian Brauner Cc: Jan Kara Cc: Zi Yan Cc: Matthew Brost Cc: Joshua Hahn Cc: Rakie Kim Cc: Byungchul Park Cc: Gregory Price Cc: Ying Huang Cc: Alistair Popple Cc: Lorenzo Stoakes Cc: "Liam R. Howlett" Cc: Vlastimil Babka Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Michal Hocko Cc: "Matthew Wilcox (Oracle)" Cc: Minchan Kim Cc: Sergey Senozhatsky Cc: Brendan Jackman Cc: Johannes Weiner Cc: Jason Gunthorpe Cc: John Hubbard Cc: Peter Xu Cc: Xu Xin Cc: Chengming Zhou Cc: Miaohe Lin Cc: Naoya Horiguchi Cc: Oscar Salvador Cc: Rik van Riel Cc: Harry Yoo Cc: Qi Zheng Cc: Shakeel Butt David Hildenbrand (29): mm/balloon_compaction: we cannot have isolated pages in the balloon list mm/balloon_compaction: convert balloon_page_delete() to balloon_page_finalize() mm/zsmalloc: drop PageIsolated() related VM_BUG_ONs mm/page_alloc: let page freeing clear any set page type mm/balloon_compaction: make PageOffline sticky until the page is freed mm/zsmalloc: make PageZsmalloc() sticky until the page is freed mm/migrate: rename isolate_movable_page() to isolate_movable_ops_page() mm/migrate: rename putback_movable_folio() to putback_movable_ops_page() mm/migrate: factor out movable_ops page handling into migrate_movable_ops_page() mm/migrate: remove folio_test_movable() and folio_movable_ops() mm/migrate: move movable_ops page handling out of move_to_new_folio() mm/zsmalloc: stop using __ClearPageMovable() mm/balloon_compaction: stop using __ClearPageMovable() mm/migrate: remove __ClearPageMovable() mm/migration: remove PageMovable() mm: rename __PageMovable() to page_has_movable_ops() mm/page_isolation: drop __folio_test_movable() check for large folios mm: remove __folio_test_movable() mm: stop storing migration_ops in page->mapping mm: convert "movable" flag in page->mapping to a page flag mm: rename PG_isolated to PG_movable_ops_isolated mm/page-flags: rename PAGE_MAPPING_MOVABLE to PAGE_MAPPING_ANON_KSM mm/page-alloc: remove PageMappingFlags() mm/page-flags: remove folio_mapping_flags() mm: simplify folio_expected_ref_count() mm: rename PAGE_MAPPING_* to FOLIO_MAPPING_* docs/mm: convert from "Non-LRU page migration" to "movable_ops page migration" mm/balloon_compaction: "movable_ops" doc updates mm/balloon_compaction: provide single balloon_page_insert() and balloon_mapping_gfp_mask() Documentation/mm/page_migration.rst | 39 ++-- arch/powerpc/platforms/pseries/cmm.c | 2 +- drivers/misc/vmw_balloon.c | 3 +- drivers/virtio/virtio_balloon.c | 4 +- fs/proc/page.c | 4 +- include/linux/balloon_compaction.h | 90 ++++----- include/linux/fs.h | 2 +- include/linux/migrate.h | 46 +---- include/linux/mm.h | 4 +- include/linux/mm_types.h | 1 - include/linux/page-flags.h | 104 ++++++---- include/linux/pagemap.h | 2 +- include/linux/zsmalloc.h | 2 + mm/balloon_compaction.c | 21 ++- mm/compaction.c | 44 +---- mm/gup.c | 4 +- mm/internal.h | 2 +- mm/ksm.c | 4 +- mm/memory-failure.c | 4 +- mm/memory_hotplug.c | 8 +- mm/migrate.c | 271 ++++++++++++++++----------- mm/page_alloc.c | 12 +- mm/page_isolation.c | 12 +- mm/rmap.c | 16 +- mm/util.c | 6 +- mm/vmscan.c | 6 +- mm/zpdesc.h | 15 +- mm/zsmalloc.c | 29 ++- 28 files changed, 365 insertions(+), 392 deletions(-) base-commit: 2e462e10265dcdce546cab85a902b716e2b26d9f -- 2.49.0