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.129.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 9AB6C286D61 for ; Mon, 30 Jun 2025 13:00:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751288425; cv=none; b=GoZWT0UAhx+1ZUYTLPcC319nKjpPoEJRBoi2Ccr/QjmWwdy0MqMS6zWIYhRxLYKQQEl/9hkFPEoKjogafQDU34uEmNQLODMWj43hp7jiR07W4voUZZ3rzP3WBwq8lB2fRuyMvdWKW7ak9nhi61rQZZHKfQqwamXKn9yx23GezMw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751288425; c=relaxed/simple; bh=eDj8cHxhN1KzXcdGn1TZtgX9KNukCFTUSaK0zNVfr+Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=YQ5kdoJ4aHzM5Z9gjEP0x704o+dA8NrPwH1w7/hNQyw3n3pICas1btGHnVSwoCyQ82DNjGlQDxVAWo6YP9d1ivIGeeHiuVles+A55L9mhYSjuAu9c2eXIE/FwxcBss2ciTxF5k8D1G/H7MF4QkPEAB+3DXSEXB88ZPHyGRhLbLw= 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=CjIM9d8Z; arc=none smtp.client-ip=170.10.129.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="CjIM9d8Z" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1751288422; 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=CjIM9d8ZC+B2Zz9u+CGgK2V5TvVQoQVane9VdK7trl4fk1KL+M71eXKNeyObFvGn67c8ja 66zm2nBEAFb2WxdNUTudvt8s4ArURYD+tvQUVTSW4OqIaUrFmQ3j4mcX7aLaym0MJVdym3 WNeGBL2pvNrMuAijA3A+R6MML3la+JQ= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-481-c01_awR8OqaavMsGlFEKaw-1; Mon, 30 Jun 2025 09:00:21 -0400 X-MC-Unique: c01_awR8OqaavMsGlFEKaw-1 X-Mimecast-MFC-AGG-ID: c01_awR8OqaavMsGlFEKaw_1751288415 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4539b44e7b1so9203255e9.1 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=Yi4aaMz++d8jCwg347HmkZkrvn/fdx0GXJC4RyU1S06mKoIWzim2ifwoGOtK5SHMfr zDvrFccyztecPWcuFd0SQjFC81ADxTs6Hfuv/5qNv2MNxRlWrvs7tQuWVrX/NAAwUPHC VUsiT8ly+sVHjyWJjCAxrMYVQtCoHaA6fPNne2wiCrQP0IgzJiRngyhN+FnbRnBVnIPO x9CIRGA7M2HAxfa4si92veOVowNmoXdk+I7Y0+FFWG+3bRiKkzyuT/medFy25OeVBsKP Mwz8niFB55LTP0RilwixFyTLZ3kz7W0SuXyEvu3fmWG6U65usmMxr0ZHKbVOng3PHwBL m5jg== X-Forwarded-Encrypted: i=1; AJvYcCU/mZm63B/GtDnoT1RTcLrX4kI/uFkb3fPUYBeC+ADUM/5NBYdYBIUWfHOceGhibv6E/88NGkpL3l2n82hg@vger.kernel.org X-Gm-Message-State: AOJu0YzQ5L2Y64Fbszm7D5LHWPvd8yPcLaUcA4suYWX7+CQ5qJ1RgAR0 4RWo5ovjrIJi0FrXBgEqnR66lFIGyduMPRZTW5EhY9G0m55U8zhjEVvJN2uc0Mo/RoGuQwh7Fxm e52+GRUsZmLKbV2o71myrw/wlNobDjdeN1RUwbEGstCcjlMfL8YDq6bspDjW7f+YHa+E= X-Gm-Gg: ASbGnct1daS9wHggSmBTwyZ7uAcAKS8ZYoXe3IU6Fl6J6EdB1pzMks8NB5OP4NH6jxl kSud4c8KF0acMg9F+WsyIguvR7vrK8bwFYeLYvi1FPo3yd9elNkGf0WdY00pPOV3S1CONkRwYdp dK/GDEy+zF4CBhUPcdfvF+a4CQruXDBfauQCUFJyqj4aFhEU4ZbtwOZLSePY+7tU1Lh3pOP2OSb hQj5RDWLZwsbhqudzaIg98cnL5OfkZ22qaog0BQFDm1INL7fCyCO7QUaRXw2sBkukAJoEG2XfMu VuSot/9yKRjwjIxMUuMiEwBPxsERRg7R7fy0CJVt6ubkTuxRlngg4Ppz70vf8fdKRMXKWHS5oZT /CP1Fqxw= X-Received: by 2002:a05:600c:3f0e:b0:43d:82c:2b11 with SMTP id 5b1f17b1804b1-4538ee6fc79mr120597085e9.23.1751288414945; 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-fsdevel@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