]> www.infradead.org Git - nvme.git/commitdiff
mm: remove MIGRATE_SYNC_NO_COPY mode
authorKefeng Wang <wangkefeng.wang@huawei.com>
Fri, 24 May 2024 05:28:43 +0000 (13:28 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 4 Jul 2024 02:30:00 +0000 (19:30 -0700)
Commit 2916ecc0f9d4 ("mm/migrate: new migrate mode MIGRATE_SYNC_NO_COPY")
introduce a new MIGRATE_SYNC_NO_COPY mode to allow to offload the copy to
a device DMA engine, which is only used __migrate_device_pages() to decide
whether or not copy the old page, and the MIGRATE_SYNC_NO_COPY mode only
set in hmm, as the MIGRATE_SYNC_NO_COPY set is removed by previous
cleanup, it seems that we could remove the unnecessary
MIGRATE_SYNC_NO_COPY.

Link: https://lkml.kernel.org/r/20240524052843.182275-6-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Jane Chu <jane.chu@oracle.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jérôme Glisse <jglisse@redhat.com>
Cc: Jiaqi Yan <jiaqiyan@google.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/aio.c
fs/hugetlbfs/inode.c
include/linux/migrate_mode.h
mm/balloon_compaction.c
mm/migrate.c
mm/zsmalloc.c

index 57c9f7c077e60148c24f756f93c151cd650a4c67..07ff8bbdcd2afb0407cc44b372c378902d47f334 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -410,17 +410,7 @@ static int aio_migrate_folio(struct address_space *mapping, struct folio *dst,
        struct kioctx *ctx;
        unsigned long flags;
        pgoff_t idx;
-       int rc;
-
-       /*
-        * We cannot support the _NO_COPY case here, because copy needs to
-        * happen under the ctx->completion_lock. That does not work with the
-        * migration workflow of MIGRATE_SYNC_NO_COPY.
-        */
-       if (mode == MIGRATE_SYNC_NO_COPY)
-               return -EINVAL;
-
-       rc = 0;
+       int rc = 0;
 
        /* mapping->i_private_lock here protects against the kioctx teardown.  */
        spin_lock(&mapping->i_private_lock);
index 412f295acebe2e3e995557e984c04f9b7b193ad9..6df794ed406618593ffd28f0434738c06bcd65c6 100644 (file)
@@ -1128,10 +1128,7 @@ static int hugetlbfs_migrate_folio(struct address_space *mapping,
                hugetlb_set_folio_subpool(src, NULL);
        }
 
-       if (mode != MIGRATE_SYNC_NO_COPY)
-               folio_migrate_copy(dst, src);
-       else
-               folio_migrate_flags(dst, src);
+       folio_migrate_copy(dst, src);
 
        return MIGRATEPAGE_SUCCESS;
 }
index f37cc03f9369ed61e49f7be69564fa017ab51801..9fb482bb73237bab4b685e19ac53e5702f744293 100644 (file)
@@ -7,16 +7,11 @@
  *     on most operations but not ->writepage as the potential stall time
  *     is too significant
  * MIGRATE_SYNC will block when migrating pages
- * MIGRATE_SYNC_NO_COPY will block when migrating pages but will not copy pages
- *     with the CPU. Instead, page copy happens outside the migratepage()
- *     callback and is likely using a DMA engine. See migrate_vma() and HMM
- *     (mm/hmm.c) for users of this mode.
  */
 enum migrate_mode {
        MIGRATE_ASYNC,
        MIGRATE_SYNC_LIGHT,
        MIGRATE_SYNC,
-       MIGRATE_SYNC_NO_COPY,
 };
 
 enum migrate_reason {
index 22c96fed70b59257159758300847ab24320e3f1e..6597ebea8ae2ac1fc5ce079bad418d96070eec75 100644 (file)
@@ -234,14 +234,6 @@ static int balloon_page_migrate(struct page *newpage, struct page *page,
 {
        struct balloon_dev_info *balloon = balloon_page_device(page);
 
-       /*
-        * We can not easily support the no copy case here so ignore it as it
-        * is unlikely to be used with balloon pages. See include/linux/hmm.h
-        * for a user of the MIGRATE_SYNC_NO_COPY mode.
-        */
-       if (mode == MIGRATE_SYNC_NO_COPY)
-               return -EINVAL;
-
        VM_BUG_ON_PAGE(!PageLocked(page), page);
        VM_BUG_ON_PAGE(!PageLocked(newpage), newpage);
 
index bb6e2e555ca103c0c99e9b923bced9f3d28f7c21..72ca341982b93081de8dc5fddd6f4c2ea874fad7 100644 (file)
@@ -671,10 +671,7 @@ static int __migrate_folio(struct address_space *mapping, struct folio *dst,
        if (src_private)
                folio_attach_private(dst, folio_detach_private(src));
 
-       if (mode != MIGRATE_SYNC_NO_COPY)
-               folio_migrate_copy(dst, src);
-       else
-               folio_migrate_flags(dst, src);
+       folio_migrate_copy(dst, src);
        return MIGRATEPAGE_SUCCESS;
 }
 
@@ -903,7 +900,6 @@ static int fallback_migrate_folio(struct address_space *mapping,
                /* Only writeback folios in full synchronous migration */
                switch (mode) {
                case MIGRATE_SYNC:
-               case MIGRATE_SYNC_NO_COPY:
                        break;
                default:
                        return -EBUSY;
@@ -1161,7 +1157,6 @@ static int migrate_folio_unmap(new_folio_t get_new_folio,
                 */
                switch (mode) {
                case MIGRATE_SYNC:
-               case MIGRATE_SYNC_NO_COPY:
                        break;
                default:
                        rc = -EBUSY;
@@ -1372,7 +1367,6 @@ static int unmap_and_move_huge_page(new_folio_t get_new_folio,
                        goto out;
                switch (mode) {
                case MIGRATE_SYNC:
-               case MIGRATE_SYNC_NO_COPY:
                        break;
                default:
                        goto out;
index e90271f6e9c9b3ecbea22644344409ca790c31ff..a2a5866473bb841b8072fb33509efe44a15971cd 100644 (file)
@@ -1752,14 +1752,6 @@ static int zs_page_migrate(struct page *newpage, struct page *page,
        unsigned long old_obj, new_obj;
        unsigned int obj_idx;
 
-       /*
-        * We cannot support the _NO_COPY case here, because copy needs to
-        * happen under the zs lock, which does not work with
-        * MIGRATE_SYNC_NO_COPY workflow.
-        */
-       if (mode == MIGRATE_SYNC_NO_COPY)
-               return -EINVAL;
-
        VM_BUG_ON_PAGE(!PageIsolated(page), page);
 
        /* The page is locked, so this pointer must remain valid */