get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/2219927/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2219927,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2219927/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260405125240.2558577-3-songmuchun@bytedance.com/",
    "project": {
        "id": 2,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/2/?format=api",
        "name": "Linux PPC development",
        "link_name": "linuxppc-dev",
        "list_id": "linuxppc-dev.lists.ozlabs.org",
        "list_email": "linuxppc-dev@lists.ozlabs.org",
        "web_url": "https://github.com/linuxppc/wiki/wiki",
        "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git",
        "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/",
        "list_archive_url": "https://lore.kernel.org/linuxppc-dev/",
        "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/",
        "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"
    },
    "msgid": "<20260405125240.2558577-3-songmuchun@bytedance.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20260405125240.2558577-3-songmuchun@bytedance.com/",
    "date": "2026-04-05T12:51:53",
    "name": "[02/49] mm/sparse: add a @pgmap argument to memory deactivation paths",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "fa0863a08e02f132ca6fa6f4a554ff735c72fc30",
    "submitter": {
        "id": 78930,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/78930/?format=api",
        "name": "Muchun Song",
        "email": "songmuchun@bytedance.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260405125240.2558577-3-songmuchun@bytedance.com/mbox/",
    "series": [
        {
            "id": 498783,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/498783/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=498783",
            "date": "2026-04-05T12:51:51",
            "name": "mm: Generalize vmemmap optimization for DAX and HugeTLB",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/498783/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2219927/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2219927/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linuxppc-dev+bounces-19332-incoming=patchwork.ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linuxppc-dev@lists.ozlabs.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=bytedance.com header.i=@bytedance.com\n header.a=rsa-sha256 header.s=google header.b=fdPUoCbt;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:21b9:f100::1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-19332-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)",
            "lists.ozlabs.org;\n arc=none smtp.remote-ip=\"2607:f8b0:4864:20::1036\"",
            "lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=bytedance.com",
            "lists.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=bytedance.com header.i=@bytedance.com\n header.a=rsa-sha256 header.s=google header.b=fdPUoCbt;\n\tdkim-atps=neutral",
            "lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=bytedance.com\n (client-ip=2607:f8b0:4864:20::1036; helo=mail-pj1-x1036.google.com;\n envelope-from=songmuchun@bytedance.com; receiver=lists.ozlabs.org)"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:21b9:f100::1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fpXT226k6z1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 05 Apr 2026 22:53:42 +1000 (AEST)",
            "from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4fpXSx4BM0z2yqq;\n\tSun, 05 Apr 2026 22:53:37 +1000 (AEST)",
            "from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com\n [IPv6:2607:f8b0:4864:20::1036])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4fpXSw4pK9z2xMY\n\tfor <linuxppc-dev@lists.ozlabs.org>; Sun, 05 Apr 2026 22:53:36 +1000 (AEST)",
            "by mail-pj1-x1036.google.com with SMTP id\n 98e67ed59e1d1-354bc7c2c46so1787114a91.0\n        for <linuxppc-dev@lists.ozlabs.org>;\n Sun, 05 Apr 2026 05:53:36 -0700 (PDT)",
            "from n232-176-004.byted.org ([36.110.163.97])\n        by smtp.gmail.com with ESMTPSA id\n 98e67ed59e1d1-35de66b4808sm3748505a91.2.2026.04.05.05.53.28\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Sun, 05 Apr 2026 05:53:34 -0700 (PDT)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775393617;\n\tcv=none;\n b=RDZzo5R9uG9jE2hDwK05ttwfOzdzdpdIAUy9lwldVGDC0oj5ykVqqRraFX13cvSPQgeC1HxqusTRJ1mQYLtV34l4o2QuXODS6e06EJbnoSRtVFEhdTqgNZJL3pkMq7HIdPhH45nA4JNOs/02tSwVuxtCvh6Q0h2C6jC80ngL5F0879K28XyIeau3RYwjMkOnmkAkzQ0re9pR9EuK2EZ/pV0Q3rB+9uYOdDcjFGGY3IeN8vs61iQMvHGJh2Z7ChoS7Vj3DY/CC31PKc2rwkn7qZf0qtE+T/PBEuVJErL/FcunM4dltmnr36Ry/IljYJWsw0K1ccdHmeBFIdYDK/4W1g==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1775393617; c=relaxed/relaxed;\n\tbh=qyPeWfsO418Re5hKKT3eSnZkoPoEx5W3lIDo032LUZM=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=KtJzbpvoy7VErLqbiZbNLdufKvzzEozxCXfb/se7+H73ZgZqMp7Kynwk3CWBvGZMWsGpDDtCIKCerQSVgroku4CmL1szx2wgqILlMCCfd2SDRSHNNJmJHHuawViDg8sd7eaI1FK0blqCYOxH8JNSNXVuLV0vhgSCsF5rJSAOsDyjwzQMXEi6dHARWpxNZFzms+rK2B2CKeZWpGxy89AdtkkYpvYsOk0VH9HKKs4i0evElTk8uZCWxZ2/pItNPx9YLYdrj5icu1Pta9HX5pkhusGUC7OXzkq6scUzksY0Bbw4+l0tKCUkGiW8f83L3/avJJvn54VgWj9UPShydXnc9A==",
        "ARC-Authentication-Results": "i=1; lists.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=bytedance.com;\n dkim=pass (2048-bit key;\n unprotected) header.d=bytedance.com header.i=@bytedance.com\n header.a=rsa-sha256 header.s=google header.b=fdPUoCbt; dkim-atps=neutral;\n spf=pass (client-ip=2607:f8b0:4864:20::1036; helo=mail-pj1-x1036.google.com;\n envelope-from=songmuchun@bytedance.com;\n receiver=lists.ozlabs.org) smtp.mailfrom=bytedance.com",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=bytedance.com; s=google; t=1775393615; x=1775998415;\n darn=lists.ozlabs.org;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=qyPeWfsO418Re5hKKT3eSnZkoPoEx5W3lIDo032LUZM=;\n        b=fdPUoCbtqiT7QU9qVfdFp3xIvFEPaKNhV/HjhoQrTGiGycaDVoX/Fh8QGTQlygnU44\n         YabHTFiyN66KdKS29SKan6aET8T2VeLB9u1L1I/nPNmk352x26Uu/4BNdpRa8DrtAh1+\n         GBZpq+sp5E9g5Kpzj1CFTf/92vAa1GVhzkxPC1aYgJTnVLXdMqAeGVF/47MupgvHJDsF\n         Zo6iOPJbZ8oBvPF/moo/ZViKshIiGrhoDkZr630lp+NnfXD31MOLDHPXmmeac3HIxnCt\n         1sq+cdqQqq2S9caRPUzYATX5qO+jianFlQ3PSAXPZmwFs7bw5GXCDVAIXAJJ58clEAyJ\n         vARQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1775393615; x=1775998415;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=qyPeWfsO418Re5hKKT3eSnZkoPoEx5W3lIDo032LUZM=;\n        b=aOIkLAH2tlNmUrQc6pbSHRiZsFgoUSLKsZMQEH/f2+vdpdFeLB5Wfgrj9GDljyjC27\n         mYWGPVfPA8ewYo9q8b6Fk8AjPYvqSNV7n08HnihZoeOS0yIo5uVE5mb5xlZXdq5DyUVp\n         a16v1fhcTMVNF7SGDUonMQXsCrWmpBbQrl/MXjyV1AbgC+n6LTiRff7Mye/3JzRRFbWq\n         H/pRSd63UaSs0iJSXanO0fN9ZLPo7ykb6k+1Hcv0S0g/QQr5OGn7Vb87f0sPceV1i1T8\n         kTPbGKO6J64YJgeMX8YRWK3wwrU0NkysDhCVQCVuFW1laObhKIwz77dX7lh9hVt5ZpZu\n         3TWQ==",
        "X-Forwarded-Encrypted": "i=1;\n AJvYcCUAq3fplk+rqG340egYx/gMFAYdfCxAffblvgeCx1fgfStf7CE26xXzu/4Xp2c1Ni7LdIX0HL8y9YAbyEM=@lists.ozlabs.org",
        "X-Gm-Message-State": "AOJu0YyvxhcQeUovd9UvdjiYtzCYa84WuInE9szg0N/GOJSDmncZpGmy\n\trHi1OnfM3ENISpvoI8PX7kuvkQk6z9SIDe8wbC/ceReoEbKnlGilhmiBWw94nqJtaOE=",
        "X-Gm-Gg": "AeBDiesZlCLOaM9A/sge2rmppc6wSmVvUWTiqaAMRxTkKseAwHzVFYT+Byf0uYA9vYm\n\tH5tjh9+ZusRCtVCu3LFLaIviXsfJeSCmf7EwL3VkojBXl6njdv2PqadQdHbTebUcMcC0k3PmkBT\n\ts7KftismPLfEFV/669P5S9avu7gBPHVUpoltWpgSoVrL1mzgly6arDyC6NtwASeTt/SJ0o+rJD/\n\t2rGOlzhgtEiQbTKHdS1WNoF6aOqBojhTmwuh/pk7dBa0QVzY0Ols35GphgyxVKivLStnewAvqIq\n\tADGYDElCNZoK9oycGjNVyNjn8+kEmKmRrotMrv3gbNJN3AsHB1Hty337fk8vDwBfX+kVN5IToPT\n\tZeq0XXtQ4lGlEm+C73P7N5Fm0B9BxpiswkHhhOm8CZ3bOu+CW+XztkO6rM6lK/MBFxdd2kLM2aE\n\tqr3ZLdyDk23Pu1fPZOA+NjiVkoJfp+JMTYFoHxAgoWelY=",
        "X-Received": "by 2002:a17:90b:4ac7:b0:35d:a8d9:3b4 with SMTP id\n 98e67ed59e1d1-35de678f7d7mr8776631a91.4.1775393614559;\n        Sun, 05 Apr 2026 05:53:34 -0700 (PDT)",
        "From": "Muchun Song <songmuchun@bytedance.com>",
        "To": "Andrew Morton <akpm@linux-foundation.org>,\n\tDavid Hildenbrand <david@kernel.org>,\n\tMuchun Song <muchun.song@linux.dev>,\n\tOscar Salvador <osalvador@suse.de>,\n\tMichael Ellerman <mpe@ellerman.id.au>,\n\tMadhavan Srinivasan <maddy@linux.ibm.com>",
        "Cc": "Lorenzo Stoakes <ljs@kernel.org>,\n\t\"Liam R . Howlett\" <Liam.Howlett@oracle.com>,\n\tVlastimil Babka <vbabka@kernel.org>,\n\tMike Rapoport <rppt@kernel.org>,\n\tSuren Baghdasaryan <surenb@google.com>,\n\tMichal Hocko <mhocko@suse.com>,\n\tNicholas Piggin <npiggin@gmail.com>,\n\tChristophe Leroy <chleroy@kernel.org>,\n\taneesh.kumar@linux.ibm.com,\n\tjoao.m.martins@oracle.com,\n\tlinux-mm@kvack.org,\n\tlinuxppc-dev@lists.ozlabs.org,\n\tlinux-kernel@vger.kernel.org,\n\tMuchun Song <songmuchun@bytedance.com>",
        "Subject": "[PATCH 02/49] mm/sparse: add a @pgmap argument to memory deactivation\n paths",
        "Date": "Sun,  5 Apr 2026 20:51:53 +0800",
        "Message-Id": "<20260405125240.2558577-3-songmuchun@bytedance.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20260405125240.2558577-1-songmuchun@bytedance.com>",
        "References": "<20260405125240.2558577-1-songmuchun@bytedance.com>",
        "X-Mailing-List": "linuxppc-dev@lists.ozlabs.org",
        "List-Id": "<linuxppc-dev.lists.ozlabs.org>",
        "List-Help": "<mailto:linuxppc-dev+help@lists.ozlabs.org>",
        "List-Owner": "<mailto:linuxppc-dev+owner@lists.ozlabs.org>",
        "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>",
        "List-Archive": "<https://lore.kernel.org/linuxppc-dev/>,\n  <https://lists.ozlabs.org/pipermail/linuxppc-dev/>",
        "List-Subscribe": "<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>",
        "List-Unsubscribe": "<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>",
        "Precedence": "list",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Spam-Status": "No, score=-0.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tDKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS\n\tautolearn=disabled version=4.0.1 OzLabs 8",
        "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"
    },
    "content": "Currently, memory hot-remove paths do not pass the struct dev_pagemap\npointer down to section_deactivate(). This prevents the lower levels\nfrom knowing whether the section was originally populated with vmemmap\noptimizations (e.g., DAX with HVO enabled).\n\nWithout this information, we cannot call vmemmap_can_optimize() to\ndetermine if the vmemmap pages were optimized. As a result, the vmemmap\npage accounting during teardown will mistakenly assume a non-optimized\nallocation, leading to incorrect page statistics.\n\nTo lay the groundwork for fixing the vmemmap page accounting, we need\nto pass the @pgmap pointer down to the deactivation location. Plumb the\n@pgmap argument through the APIs of arch_remove_memory(), __remove_pages()\nand sparse_remove_section(), mirroring the corresponding *_activate()\npaths.\n\nSigned-off-by: Muchun Song <songmuchun@bytedance.com>\n---\n arch/arm64/mm/mmu.c            |  5 +++--\n arch/loongarch/mm/init.c       |  5 +++--\n arch/powerpc/mm/mem.c          |  5 +++--\n arch/riscv/mm/init.c           |  5 +++--\n arch/s390/mm/init.c            |  5 +++--\n arch/x86/mm/init_64.c          |  5 +++--\n include/linux/memory_hotplug.h |  8 +++++---\n mm/memory_hotplug.c            | 12 ++++++------\n mm/memremap.c                  |  4 ++--\n mm/sparse-vmemmap.c            |  8 ++++----\n 10 files changed, 35 insertions(+), 27 deletions(-)",
    "diff": "diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c\nindex ec1c6971a561..dc8a8281888c 100644\n--- a/arch/arm64/mm/mmu.c\n+++ b/arch/arm64/mm/mmu.c\n@@ -1994,12 +1994,13 @@ int arch_add_memory(int nid, u64 start, u64 size,\n \treturn ret;\n }\n \n-void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)\n+void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap,\n+\t\t\tstruct dev_pagemap *pgmap)\n {\n \tunsigned long start_pfn = start >> PAGE_SHIFT;\n \tunsigned long nr_pages = size >> PAGE_SHIFT;\n \n-\t__remove_pages(start_pfn, nr_pages, altmap);\n+\t__remove_pages(start_pfn, nr_pages, altmap, pgmap);\n \t__remove_pgd_mapping(swapper_pg_dir, __phys_to_virt(start), size);\n }\n \ndiff --git a/arch/loongarch/mm/init.c b/arch/loongarch/mm/init.c\nindex 00f3822b6e47..c9c57f08fa2c 100644\n--- a/arch/loongarch/mm/init.c\n+++ b/arch/loongarch/mm/init.c\n@@ -86,7 +86,8 @@ int arch_add_memory(int nid, u64 start, u64 size, struct mhp_params *params)\n \treturn ret;\n }\n \n-void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)\n+void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap,\n+\t\t\tstruct dev_pagemap *pgmap)\n {\n \tunsigned long start_pfn = start >> PAGE_SHIFT;\n \tunsigned long nr_pages = size >> PAGE_SHIFT;\n@@ -95,7 +96,7 @@ void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)\n \t/* With altmap the first mapped page is offset from @start */\n \tif (altmap)\n \t\tpage += vmem_altmap_offset(altmap);\n-\t__remove_pages(start_pfn, nr_pages, altmap);\n+\t__remove_pages(start_pfn, nr_pages, altmap, pgmap);\n }\n #endif\n \ndiff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c\nindex 648d0c5602ec..4c1afab91996 100644\n--- a/arch/powerpc/mm/mem.c\n+++ b/arch/powerpc/mm/mem.c\n@@ -158,12 +158,13 @@ int __ref arch_add_memory(int nid, u64 start, u64 size,\n \treturn rc;\n }\n \n-void __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)\n+void __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap,\n+\t\t\t      struct dev_pagemap *pgmap)\n {\n \tunsigned long start_pfn = start >> PAGE_SHIFT;\n \tunsigned long nr_pages = size >> PAGE_SHIFT;\n \n-\t__remove_pages(start_pfn, nr_pages, altmap);\n+\t__remove_pages(start_pfn, nr_pages, altmap, pgmap);\n \tarch_remove_linear_mapping(start, size);\n }\n #endif\ndiff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c\nindex 5142ca80be6f..980f693e6b19 100644\n--- a/arch/riscv/mm/init.c\n+++ b/arch/riscv/mm/init.c\n@@ -1810,9 +1810,10 @@ int __ref arch_add_memory(int nid, u64 start, u64 size, struct mhp_params *param\n \treturn ret;\n }\n \n-void __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)\n+void __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap,\n+\t\t\t      struct dev_pagemap *pgmap)\n {\n-\t__remove_pages(start >> PAGE_SHIFT, size >> PAGE_SHIFT, altmap);\n+\t__remove_pages(start >> PAGE_SHIFT, size >> PAGE_SHIFT, altmap, pgmap);\n \tremove_linear_mapping(start, size);\n \tflush_tlb_all();\n }\ndiff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c\nindex 1f72efc2a579..11a689423440 100644\n--- a/arch/s390/mm/init.c\n+++ b/arch/s390/mm/init.c\n@@ -276,12 +276,13 @@ int arch_add_memory(int nid, u64 start, u64 size,\n \treturn rc;\n }\n \n-void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)\n+void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap,\n+\t\t\tstruct dev_pagemap *pgmap)\n {\n \tunsigned long start_pfn = start >> PAGE_SHIFT;\n \tunsigned long nr_pages = size >> PAGE_SHIFT;\n \n-\t__remove_pages(start_pfn, nr_pages, altmap);\n+\t__remove_pages(start_pfn, nr_pages, altmap, pgmap);\n \tvmem_remove_mapping(start, size);\n }\n #endif /* CONFIG_MEMORY_HOTPLUG */\ndiff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c\nindex df2261fa4f98..77b889b71cf3 100644\n--- a/arch/x86/mm/init_64.c\n+++ b/arch/x86/mm/init_64.c\n@@ -1288,12 +1288,13 @@ kernel_physical_mapping_remove(unsigned long start, unsigned long end)\n \tremove_pagetable(start, end, true, NULL);\n }\n \n-void __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)\n+void __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap,\n+\t\t\t      struct dev_pagemap *pgmap)\n {\n \tunsigned long start_pfn = start >> PAGE_SHIFT;\n \tunsigned long nr_pages = size >> PAGE_SHIFT;\n \n-\t__remove_pages(start_pfn, nr_pages, altmap);\n+\t__remove_pages(start_pfn, nr_pages, altmap, pgmap);\n \tkernel_physical_mapping_remove(start, start + size);\n }\n #endif /* CONFIG_MEMORY_HOTPLUG */\ndiff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h\nindex 815e908c4135..7c9d66729c60 100644\n--- a/include/linux/memory_hotplug.h\n+++ b/include/linux/memory_hotplug.h\n@@ -135,9 +135,10 @@ static inline bool movable_node_is_enabled(void)\n \treturn movable_node_enabled;\n }\n \n-extern void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap);\n+extern void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap,\n+\t\t\t       struct dev_pagemap *pgmap);\n extern void __remove_pages(unsigned long start_pfn, unsigned long nr_pages,\n-\t\t\t   struct vmem_altmap *altmap);\n+\t\t\t   struct vmem_altmap *altmap, struct dev_pagemap *pgmap);\n \n /* reasonably generic interface to expand the physical pages */\n extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,\n@@ -307,7 +308,8 @@ extern int sparse_add_section(int nid, unsigned long pfn,\n \t\tunsigned long nr_pages, struct vmem_altmap *altmap,\n \t\tstruct dev_pagemap *pgmap);\n extern void sparse_remove_section(unsigned long pfn, unsigned long nr_pages,\n-\t\t\t\t  struct vmem_altmap *altmap);\n+\t\t\t\t  struct vmem_altmap *altmap,\n+\t\t\t\t  struct dev_pagemap *pgmap);\n extern struct zone *zone_for_pfn_range(enum mmop online_type,\n \t\tint nid, struct memory_group *group, unsigned long start_pfn,\n \t\tunsigned long nr_pages);\ndiff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c\nindex 8b18ddd1e7d5..05f5df12d843 100644\n--- a/mm/memory_hotplug.c\n+++ b/mm/memory_hotplug.c\n@@ -583,7 +583,7 @@ void remove_pfn_range_from_zone(struct zone *zone,\n  * calling offline_pages().\n  */\n void __remove_pages(unsigned long pfn, unsigned long nr_pages,\n-\t\t    struct vmem_altmap *altmap)\n+\t\t    struct vmem_altmap *altmap, struct dev_pagemap *pgmap)\n {\n \tconst unsigned long end_pfn = pfn + nr_pages;\n \tunsigned long cur_nr_pages;\n@@ -598,7 +598,7 @@ void __remove_pages(unsigned long pfn, unsigned long nr_pages,\n \t\t/* Select all remaining pages up to the next section boundary */\n \t\tcur_nr_pages = min(end_pfn - pfn,\n \t\t\t\t   SECTION_ALIGN_UP(pfn + 1) - pfn);\n-\t\tsparse_remove_section(pfn, cur_nr_pages, altmap);\n+\t\tsparse_remove_section(pfn, cur_nr_pages, altmap, pgmap);\n \t}\n }\n \n@@ -1418,7 +1418,7 @@ static void remove_memory_blocks_and_altmaps(u64 start, u64 size)\n \n \t\tremove_memory_block_devices(cur_start, memblock_size);\n \n-\t\tarch_remove_memory(cur_start, memblock_size, altmap);\n+\t\tarch_remove_memory(cur_start, memblock_size, altmap, NULL);\n \n \t\t/* Verify that all vmemmap pages have actually been freed. */\n \t\tWARN(altmap->alloc, \"Altmap not fully unmapped\");\n@@ -1461,7 +1461,7 @@ static int create_altmaps_and_memory_blocks(int nid, struct memory_group *group,\n \t\tret = create_memory_block_devices(cur_start, memblock_size, nid,\n \t\t\t\t\t\t  params.altmap, group);\n \t\tif (ret) {\n-\t\t\tarch_remove_memory(cur_start, memblock_size, NULL);\n+\t\t\tarch_remove_memory(cur_start, memblock_size, NULL, NULL);\n \t\t\tkfree(params.altmap);\n \t\t\tgoto out;\n \t\t}\n@@ -1547,7 +1547,7 @@ int add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)\n \t\t/* create memory block devices after memory was added */\n \t\tret = create_memory_block_devices(start, size, nid, NULL, group);\n \t\tif (ret) {\n-\t\t\tarch_remove_memory(start, size, params.altmap);\n+\t\t\tarch_remove_memory(start, size, params.altmap, NULL);\n \t\t\tgoto error;\n \t\t}\n \t}\n@@ -2246,7 +2246,7 @@ static int try_remove_memory(u64 start, u64 size)\n \t\t * No altmaps present, do the removal directly\n \t\t */\n \t\tremove_memory_block_devices(start, size);\n-\t\tarch_remove_memory(start, size, NULL);\n+\t\tarch_remove_memory(start, size, NULL, NULL);\n \t} else {\n \t\t/* all memblocks in the range have altmaps */\n \t\tremove_memory_blocks_and_altmaps(start, size);\ndiff --git a/mm/memremap.c b/mm/memremap.c\nindex ac7be07e3361..c45b90f334ea 100644\n--- a/mm/memremap.c\n+++ b/mm/memremap.c\n@@ -97,10 +97,10 @@ static void pageunmap_range(struct dev_pagemap *pgmap, int range_id)\n \t\t\t\t   PHYS_PFN(range_len(range)));\n \tif (pgmap->type == MEMORY_DEVICE_PRIVATE) {\n \t\t__remove_pages(PHYS_PFN(range->start),\n-\t\t\t       PHYS_PFN(range_len(range)), NULL);\n+\t\t\t       PHYS_PFN(range_len(range)), NULL, pgmap);\n \t} else {\n \t\tarch_remove_memory(range->start, range_len(range),\n-\t\t\t\tpgmap_altmap(pgmap));\n+\t\t\t\tpgmap_altmap(pgmap), pgmap);\n \t\tkasan_remove_zero_shadow(__va(range->start), range_len(range));\n \t}\n \tmem_hotplug_done();\ndiff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c\nindex ee27d0c0efe2..7aa9a97498eb 100644\n--- a/mm/sparse-vmemmap.c\n+++ b/mm/sparse-vmemmap.c\n@@ -737,7 +737,7 @@ static int fill_subsection_map(unsigned long pfn, unsigned long nr_pages)\n  * usage map, but still need to free the vmemmap range.\n  */\n static void section_deactivate(unsigned long pfn, unsigned long nr_pages,\n-\t\tstruct vmem_altmap *altmap)\n+\t\tstruct vmem_altmap *altmap, struct dev_pagemap *pgmap)\n {\n \tstruct mem_section *ms = __pfn_to_section(pfn);\n \tbool section_is_early = early_section(ms);\n@@ -824,7 +824,7 @@ static struct page * __meminit section_activate(int nid, unsigned long pfn,\n \tmemmap = populate_section_memmap(pfn, nr_pages, nid, altmap, pgmap);\n \tmemmap_pages_add(DIV_ROUND_UP(nr_pages * sizeof(struct page), PAGE_SIZE));\n \tif (!memmap) {\n-\t\tsection_deactivate(pfn, nr_pages, altmap);\n+\t\tsection_deactivate(pfn, nr_pages, altmap, pgmap);\n \t\treturn ERR_PTR(-ENOMEM);\n \t}\n \n@@ -885,13 +885,13 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn,\n }\n \n void sparse_remove_section(unsigned long pfn, unsigned long nr_pages,\n-\t\t\t   struct vmem_altmap *altmap)\n+\t\t\t   struct vmem_altmap *altmap, struct dev_pagemap *pgmap)\n {\n \tstruct mem_section *ms = __pfn_to_section(pfn);\n \n \tif (WARN_ON_ONCE(!valid_section(ms)))\n \t\treturn;\n \n-\tsection_deactivate(pfn, nr_pages, altmap);\n+\tsection_deactivate(pfn, nr_pages, altmap, pgmap);\n }\n #endif /* CONFIG_MEMORY_HOTPLUG */\n",
    "prefixes": [
        "02/49"
    ]
}