get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2219940,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2219940/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260405125240.2558577-16-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-16-songmuchun@bytedance.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20260405125240.2558577-16-songmuchun@bytedance.com/",
    "date": "2026-04-05T12:52:06",
    "name": "[15/49] mm/hugetlb: free cross-zone bootmem gigantic pages after allocation",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "a11dd79f6ff8cebdb96852d8b1cd18b023a0b5b6",
    "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-16-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/2219940/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2219940/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linuxppc-dev+bounces-19345-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=gRZckZkl;\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-19345-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::102a\"",
            "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=gRZckZkl;\n\tdkim-atps=neutral",
            "lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=bytedance.com\n (client-ip=2607:f8b0:4864:20::102a; helo=mail-pj1-x102a.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)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fpXVl0NXdz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 05 Apr 2026 22:55:11 +1000 (AEST)",
            "from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4fpXVb57jLz2yr9;\n\tSun, 05 Apr 2026 22:55:03 +1000 (AEST)",
            "from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com\n [IPv6:2607:f8b0:4864:20::102a])\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 4fpXVZ5z4cz2yjs\n\tfor <linuxppc-dev@lists.ozlabs.org>; Sun, 05 Apr 2026 22:55:02 +1000 (AEST)",
            "by mail-pj1-x102a.google.com with SMTP id\n 98e67ed59e1d1-354bc7c2c46so1787437a91.0\n        for <linuxppc-dev@lists.ozlabs.org>;\n Sun, 05 Apr 2026 05:55:02 -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.54.53\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Sun, 05 Apr 2026 05:55:00 -0700 (PDT)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775393703;\n\tcv=none;\n b=Q54puTsnQsNctZjXBydMP40Om/a5bAPjHZ0PFH/mm+d8dNTBibPTXuf/ZgjRJg3T19qB1Hopg0n/qZ97gCk0cC5T6HEpTR6zOjYBtEhJzXQwffSZvCotKkezEbLwdB9boVEc9HPvuNgwbyOu4MkBGkdrwCohhvMysZh/qvcr1juJ7krZRrSHwPsPDT1+z3FxkBUvdc77SPO/N1zWyHqjFvpahS+k8Y/S3mS5JYcJ3rCPUmAICVTHOEXRhcVXn/4qwZG7vqSt13to8dZCMzs9p7iepKwPkKvhYZ4xec6qape7lHSrUw7xaWlNPJ8+FjjHGwKucPnynyUyKJ6b4tLwzw==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1775393703; c=relaxed/relaxed;\n\tbh=QwFPS6YUW38IEMACgWNvn97a3hFqhS5O4/kjgd2aI1E=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=oHq4Vcpjvpl9tu281Xc9FP6pCD5tigUk2WlX2dj9kkjaJKArdpleclsBWvXa+9zJ554YP+kCOZQ44N9IOSCisVYat86Czi/Z1CZRo6XwKB8eeQo9CAJKlKzrGxLpPW+6ANrxZqSuJCvtWLcvQ7v9Py46BgNZ9+7jO8wpv6rONun9V1A4b0oTbNnUXYQRChn+bWF4+aLcnzgFWhMmTP7o9QcsYU+Vset1lWhmGwa70yDt3ndcVbPMJ9IC4iWAQkEh1W2BzW8vQpPvPAcFh5Z2u1FVtWfWpPSixB2acSJGGqxbaeeg8D55UZTt0ZeqCWMzJxxpRDiLdhTzWOjNgnyw2g==",
        "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=gRZckZkl; dkim-atps=neutral;\n spf=pass (client-ip=2607:f8b0:4864:20::102a; helo=mail-pj1-x102a.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=1775393701; x=1775998501;\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=QwFPS6YUW38IEMACgWNvn97a3hFqhS5O4/kjgd2aI1E=;\n        b=gRZckZklLFteDeghJVauD76fCI3D/D5Bg7xSQV7nQN5+Q35ri6ih3RSDiXqCBU9tZ1\n         C2RMQljkJkrYQvssPiHabb4sfh3XGWtM9kjhR8UmWCJHSAMYaAaOYdu1aUFy1iNB2qiX\n         Yaz4WTGW+aDeAAbjfyNHBIIwrqWx/U3ltUS0BOJ8plNgAJRxyncGlZiRHrcSC0WALHY9\n         nL45dkqfbljzEMvHL7VqHJz6Ja0RXH5/NvmHYM+F2kARATLepqTTHTuXvF5Kifsgi//f\n         /e/phFcKlWqOynLdpaoOMrBi3n+46loEMD4pIQ8UfC1M3d9MzFBU5Ji3aKJt2+pZCgBA\n         D0JQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1775393701; x=1775998501;\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=QwFPS6YUW38IEMACgWNvn97a3hFqhS5O4/kjgd2aI1E=;\n        b=eWifNmuX/Z/Z7aqlW+uKzNo2IT9YptzSlSIh03yFYQaJxp51rge+J8jCUog1IOHFeT\n         Fg0LAmlyN5dAeguLAn1oGz95ZKjEI3vP1bH9maG30qJIctA8EKiXEKbpSV8rMXNqItxb\n         X8J1aetJVofdZ2auxcn+HKUobNs3sxCcjOIg1dFCbDsLCs6eIoU+t/2iOdrKfI1tD2qk\n         S9z5vewBdnCrveLnVrbK2pG200fbGVDij3Jh/6tvEMxXAkhq31t/nwqCcr4ItvI0pzOx\n         S65JNs3TTQ0SX3olBZ7RgXMCFLAovNLuZ379SIAppjK3dQq/rwUc/we+pTPmUTelGi8t\n         IigQ==",
        "X-Forwarded-Encrypted": "i=1;\n AJvYcCUCJKIxr9+dLmxT8al+xf17J8Ay6tWafH35GUASyrf9D2x6Jk181Uyzjcvgee/RBzBOIjwCOcthX952FRA=@lists.ozlabs.org",
        "X-Gm-Message-State": "AOJu0Yz8573hQ7r/lBHpWTmayW5go9LbA4g/2u9z5eR9yL1h/319glQi\n\tXN9qoJgkWn4bhAvZpzE6MZyzwWx4i6VOeAJW5mRwgIDjyAo+0Ki97a/jgGdYXJA2d3g=",
        "X-Gm-Gg": "AeBDievb1a6qbAx1TS7Zg0GDY4ccREyGOO6Ye8OqczOGJfrZFaVJvOojr1z7ogdirIG\n\tPOYhDIHtuD6hWTN2B/t3g8WXjTf+gFcxdyiow+lJzqikSwCOVYkv+w0ZE1r/lTB9u8P2wns1vaZ\n\tBRTkARFaQCGZV6TiApa0WQeXgJkpMiTicqHRxrFkaRSDOfOSR7I8m273w1+hAm2lz2s5zrIERSZ\n\tO38yhkWAd1JRCShdpxiHtHRA3YtHr91/62JThnD56HkZsrmcJOhnUuv5X/YwnrdRBWIohWShyNG\n\t1bUoUgCplkTByBAP39YsKHh8FyExEbvhGjcFRqV44WkuICUCcg022sPmR3fnNk5yEEhIBEY0GST\n\t0vLckT/Eul7TUktvMrqKj+OaKjsy7MDGoYoeETAXkZoA+tFqY/WVYO4ZOEwioKFVylTET01FEfj\n\tJpGHuCsxVa5SxD7gPfCp7DEeGW44Wu1yGPaQxalYzMmdY=",
        "X-Received": "by 2002:a17:90a:d406:b0:35b:945d:752a with SMTP id\n 98e67ed59e1d1-35de68f82damr8709011a91.17.1775393700794;\n        Sun, 05 Apr 2026 05:55:00 -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 15/49] mm/hugetlb: free cross-zone bootmem gigantic pages\n after allocation",
        "Date": "Sun,  5 Apr 2026 20:52:06 +0800",
        "Message-Id": "<20260405125240.2558577-16-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": "After moving hugetlb reservation after free_area_init(), zone information\nbecomes available during bootmem huge page allocation. This allows us to\nidentify and handle cross-zone gigantic pages more precisely.\n\nDuring alloc_bootmem(), pages that intersect multiple zones are added to\nthe head of huge_boot_pages[nid] list (without ZONES_VALID flag), while\npages with valid zones are added to the tail (with ZONES_VALID flag).\n\nAfter allocation completes, hugetlb_free_cross_zone_pages() iterates\nthrough the list and frees those cross-zone pages (entries without\nHUGE_BOOTMEM_ZONES_VALID flag). The count of freed pages is subtracted\nfrom the allocated count to ensure the final number reflects only valid\nhuge pages.\n\nThis applies to both per-node allocation path and the global gigantic\nallocation path, simplifying the code by avoiding cross-zone checks at\nlater stages.\n\nSigned-off-by: Muchun Song <songmuchun@bytedance.com>\n---\n mm/hugetlb.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++------\n 1 file changed, 47 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/mm/hugetlb.c b/mm/hugetlb.c\nindex d6ea11113f1d..238495fd04e4 100644\n--- a/mm/hugetlb.c\n+++ b/mm/hugetlb.c\n@@ -3049,6 +3049,11 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma,\n \treturn ERR_PTR(-ENOSPC);\n }\n \n+static bool __init hugetlb_bootmem_page_earlycma(struct huge_bootmem_page *m)\n+{\n+\treturn m->flags & HUGE_BOOTMEM_CMA;\n+}\n+\n static __init void *alloc_bootmem(struct hstate *h, int nid, bool node_exact)\n {\n \tstruct huge_bootmem_page *m;\n@@ -3092,7 +3097,14 @@ static __init void *alloc_bootmem(struct hstate *h, int nid, bool node_exact)\n \t\t * is not up yet.\n \t\t */\n \t\tINIT_LIST_HEAD(&m->list);\n-\t\tlist_add(&m->list, &huge_boot_pages[listnode]);\n+\t\tif (pfn_range_intersects_zones(listnode, PHYS_PFN(virt_to_phys(m)),\n+\t\t\t\t\t       pages_per_huge_page(h))) {\n+\t\t\tVM_BUG_ON(hugetlb_bootmem_page_earlycma(m));\n+\t\t\tlist_add(&m->list, &huge_boot_pages[listnode]);\n+\t\t} else {\n+\t\t\tlist_add_tail(&m->list, &huge_boot_pages[listnode]);\n+\t\t\tm->flags |= HUGE_BOOTMEM_ZONES_VALID;\n+\t\t}\n \t\tm->hstate = h;\n \t}\n \n@@ -3186,11 +3198,6 @@ static bool __init hugetlb_bootmem_page_prehvo(struct huge_bootmem_page *m)\n \treturn m->flags & HUGE_BOOTMEM_HVO;\n }\n \n-static bool __init hugetlb_bootmem_page_earlycma(struct huge_bootmem_page *m)\n-{\n-\treturn m->flags & HUGE_BOOTMEM_CMA;\n-}\n-\n /*\n  * memblock-allocated pageblocks might not have the migrate type set\n  * if marked with the 'noinit' flag. Set it to the default (MIGRATE_MOVABLE)\n@@ -3393,6 +3400,34 @@ static void __init gather_bootmem_prealloc(void)\n \tpadata_do_multithreaded(&job);\n }\n \n+static unsigned long __init hugetlb_free_cross_zone_pages(struct hstate *h, int nid)\n+{\n+\tunsigned long freed = 0;\n+\tstruct huge_bootmem_page *m, *tmp;\n+\n+\tif (!hstate_is_gigantic(h))\n+\t\treturn freed;\n+\n+\tlist_for_each_entry_safe(m, tmp, &huge_boot_pages[nid], list) {\n+\t\tif (m->flags & HUGE_BOOTMEM_ZONES_VALID)\n+\t\t\tbreak;\n+\n+\t\tlist_del(&m->list);\n+\t\tmemblock_free(m, huge_page_size(h));\n+\t\tfreed++;\n+\t}\n+\n+\tif (freed) {\n+\t\tchar buf[32];\n+\n+\t\tstring_get_size(huge_page_size(h), 1, STRING_UNITS_2, buf, sizeof(buf));\n+\t\tpr_warn(\"HugeTLB: freeing %lu cross-zone hugepage of page size %s failed node%d.\\n\",\n+\t\t\tfreed, buf, nid);\n+\t}\n+\n+\treturn freed;\n+}\n+\n static void __init hugetlb_hstate_alloc_pages_onenode(struct hstate *h, int nid)\n {\n \tunsigned long i;\n@@ -3423,6 +3458,8 @@ static void __init hugetlb_hstate_alloc_pages_onenode(struct hstate *h, int nid)\n \t\tcond_resched();\n \t}\n \n+\ti -= hugetlb_free_cross_zone_pages(h, nid);\n+\n \tif (!list_empty(&folio_list))\n \t\tprep_and_add_allocated_folios(h, &folio_list);\n \n@@ -3496,6 +3533,7 @@ static void __init hugetlb_pages_alloc_boot_node(unsigned long start, unsigned l\n \n static unsigned long __init hugetlb_gigantic_pages_alloc_boot(struct hstate *h)\n {\n+\tint nid;\n \tunsigned long i;\n \n \tfor (i = 0; i < h->max_huge_pages; ++i) {\n@@ -3504,6 +3542,9 @@ static unsigned long __init hugetlb_gigantic_pages_alloc_boot(struct hstate *h)\n \t\tcond_resched();\n \t}\n \n+\tfor_each_node(nid)\n+\t\ti -= hugetlb_free_cross_zone_pages(h, nid);\n+\n \treturn i;\n }\n \n",
    "prefixes": [
        "15/49"
    ]
}