Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2219934/?format=api
{ "id": 2219934, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2219934/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260405125240.2558577-10-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-10-songmuchun@bytedance.com>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20260405125240.2558577-10-songmuchun@bytedance.com/", "date": "2026-04-05T12:52:00", "name": "[09/49] mm: panic on memory allocation failure in sparse_init_nid()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "5762c21ec8e7ea4ba608b1cdc90551c35dc582c8", "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-10-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/2219934/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2219934/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linuxppc-dev+bounces-19339-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=U8lAvZWk;\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-19339-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=U8lAvZWk;\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 4fpXTy27pYz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 05 Apr 2026 22:54:30 +1000 (AEST)", "from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4fpXTq1qHbz305M;\n\tSun, 05 Apr 2026 22:54:23 +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 4fpXTp3c6sz2xMY\n\tfor <linuxppc-dev@lists.ozlabs.org>; Sun, 05 Apr 2026 22:54:22 +1000 (AEST)", "by mail-pj1-x102a.google.com with SMTP id\n 98e67ed59e1d1-35d99bae2ebso2818413a91.3\n for <linuxppc-dev@lists.ozlabs.org>;\n Sun, 05 Apr 2026 05:54:22 -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.15\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 05 Apr 2026 05:54:19 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775393663;\n\tcv=none;\n b=fwrCuM/QH+WT/Bi8eRGmzX+3Vo02I4UWb+kTKC5S0h82QYfanVKwfPhGvmKqKc69WmsP18YJrG7sboVeoq8bP/gtaC3XOMpDnIvdxcA9+8VKpZUqQLEFUnMUwySNVwXvi7695EOn53L0/o6bXXV4dHIydqwf8OCPj5rK0ErDQiaT/VAJCbyLaeTqWm9D6u38iJjfgmr+Rf0DVmJvJpOh7H7kaq5sCEEU3J3qRyAvGOkSo+rPjnCa9merabYm+2VrbmcPSKYbZjnb7JXDEpJES8I8bWB3cpYm/0++0IfeBAUs7d9gfXjQc5L3DjSTdHUnK9q4To0Cx1ODVqnhWeEW3A==", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1775393663; c=relaxed/relaxed;\n\tbh=32+AkcMilp9VVAfduQufKDvkeOaHLrnbBWuUoleVhXI=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=O5e1/EU/knnr7CMucccnY5SdTWXyLAk5GqaQoGbbmadOmqmmmiMwN5gvWj1sa0AG6B3ugqiAtoCjbcU1qDhTbId40r6+1b8TmlrL1KKBqWvwe4AVmossBApnCUm7LYmm2zu1wf2CGh0j42vPqCMFgMBr5MKffmLosoanz9/AHyPWxSnGLglp+At0N4dHONn0Vx8IkElp1kBe+atNCcnYxa32TGijE9C/+ln01VH9uRKIJ3aljvoC7FRY5MQFp0wVnjME/Wp01jXWgFd871sdfBpe4vGD4E5k0MUkvAWs/PDwMfCL9tXAn4umO38UtMdjbhTDjWVpxtXCfLgLC3DjBw==", "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=U8lAvZWk; 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=1775393660; x=1775998460;\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=32+AkcMilp9VVAfduQufKDvkeOaHLrnbBWuUoleVhXI=;\n b=U8lAvZWkPlKJOA8h/bUUhtssi8mbm9l1sA7qAb/3pyk6iosCcC7G9inqNsB6jkN5gQ\n dqCtcYkVZsTDf3UDdI7qE1La9nC2Ce4hmmMOAoEDAJYNah8fJ/JO9nuqNwFNLLSC5CQa\n uBwrI+sxuVfIq708liMMIWmFkpw1VLSpbi7d9+vFNqmDCg/g9Xjunw/LdjiVWTFY6gFN\n gFiWS0QoZ4fSuidXM5DYTKRVMiR0oaWzWNGjm8EOCcjd3zSgJrP2ImY5yd30ii93cMXJ\n 1vGC0bgJQDFu3HnbrtDmm02RtIxvw4TJRUJZ15IdX16fwzZaD1KM43obRPmho/BGeKzk\n McGw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775393660; x=1775998460;\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=32+AkcMilp9VVAfduQufKDvkeOaHLrnbBWuUoleVhXI=;\n b=Gi8hCQqcTF19SgqAa3xxMzxeKxKk8IJZewzczV9cZAx0nD/eQcR8nTycBJVC28eHS8\n 5u38p7wILiRbjA6AglQne4pLwy429papJclko+RXvNI17Po7fx4xncnVyQ++USMdqJz9\n AY7zKxZvVPgMdDFaJCcfJtPfhnw4pR0wNApHnCIsYlH3t0wqUeOmdKeVNN1UPGdEnYPe\n 9hGzLmNhONAMR9hjeKcxiioTaVWt+a+x7TDcyfcgR5rPd/l+rT/yCUkjRqJkW67OKxjL\n QkOxT+xPTWYCI0T5/ky/xbMrEHpBYvvrY4TcJ5zNyME3WoLxzEzskJFvCFIcE8UuTRf7\n 8cxQ==", "X-Forwarded-Encrypted": "i=1;\n AJvYcCX328+vTKSvMQDO6dnqkrDiOxk2/9VeBr3NsGRUrb0ZWR7SvL6QBisnCcyhIomkW1ZqRqf+tFW2bu5lpuc=@lists.ozlabs.org", "X-Gm-Message-State": "AOJu0Yyw3xbmoauWoW0p/7qwVpYbNt1wJcO/98F/1V1Z5x9jzOlqqlw/\n\twh48jXoZizdxlwKtkU1WYwea6Mv0CPsCfHZ6MtbrHxnKxX+Hcg+8rUBBcIpTSRauRXU=", "X-Gm-Gg": "AeBDiesiiD3wjdH6y3qjWr1BARvjo5m5cbc5Uu91jU//5Papg97n4WACQEOfLB5IDwb\n\tid+cDj6LmnUnQymB5EAeu+OM3ZfAxGjkOuB5KZgMhMm/w3eZ5aWs3s00+eqOS70xCNLT5xXBqUT\n\tZiMnig35NfrNH3qZpp3i8zBcenjJz5wI487L8fOKCR7ASH9Zhk7yzOjHEc8jOtTKgLLg8rb1u58\n\ta0P09pGrRzW1UDQ/rc8mromPNLpii6jaESR+myBxES8V5rzcib81mZJZ1gjsrzpAMv/v4Yq9D+p\n\tEFG0u93MM2+Uziti9E0kvHbEMzbGgnDniGU4xl9UxyrbQtHXJnLp0sM3k47pRNjNyIfU4ayinos\n\t4yjtNNz/V54FHSWm1zZRCR0OspBengI7Bmx1yyKcyfOPh4RGzkKxkd7SUrfe/tmSjYL3LMQ7t6F\n\t90FXdOsszMMGM0PefkV8f9+UOvGiZFizAQVK7TFqfoy8k=", "X-Received": "by 2002:a17:90b:5111:b0:35d:93ff:2855 with SMTP id\n 98e67ed59e1d1-35de67eba6amr8915799a91.8.1775393660266;\n Sun, 05 Apr 2026 05:54:20 -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 09/49] mm: panic on memory allocation failure in\n sparse_init_nid()", "Date": "Sun, 5 Apr 2026 20:52:00 +0800", "Message-Id": "<20260405125240.2558577-10-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": "When vmemmap pages allocation or usemap allocation fails, sparse_init_nid()\ncurrently only marks the corresponding section as non-present. However,\nsubsequent code like memmap_init() iterating over PFNs does not check for\nnon-present sections, leading to invalid memory access (additional,\nsubsection_map_init() accessing the unallocated usemap as well).\n\nIt is complex to audit and fix all boot-time PFN iterators to handle these\npartially initialized sections correctly. Since vmemmap and usemap allocation\nfailures are extremely rare during early boot, the more appropriate approach\nis to expose the problem as early as possible.\n\nTherefore, use BUG_ON() to panic immediately if allocation fails, instead of\nattempting a partial recovery that leads to obscure crashes later.\n\nSigned-off-by: Muchun Song <songmuchun@bytedance.com>\n---\n mm/sparse.c | 37 ++++++++-----------------------------\n 1 file changed, 8 insertions(+), 29 deletions(-)", "diff": "diff --git a/mm/sparse.c b/mm/sparse.c\nindex effdac6b0ab1..5c12b979a618 100644\n--- a/mm/sparse.c\n+++ b/mm/sparse.c\n@@ -354,19 +354,15 @@ static void __init sparse_init_nid(int nid, unsigned long pnum_begin,\n \t\t\t\t unsigned long map_count)\n {\n \tunsigned long pnum;\n-\tstruct page *map;\n-\tstruct mem_section *ms;\n-\n-\tif (sparse_usage_init(nid, map_count)) {\n-\t\tpr_err(\"%s: node[%d] usemap allocation failed\", __func__, nid);\n-\t\tgoto failed;\n-\t}\n \n+\tif (sparse_usage_init(nid, map_count))\n+\t\tpanic(\"The node[%d] usemap allocation failed\\n\", nid);\n \tsparse_buffer_init(map_count * section_map_size(), nid);\n \n \tsparse_vmemmap_init_nid_early(nid);\n \n \tfor_each_present_section_nr(pnum_begin, pnum) {\n+\t\tstruct mem_section *ms;\n \t\tunsigned long pfn = section_nr_to_pfn(pnum);\n \n \t\tif (pnum >= pnum_end)\n@@ -374,16 +370,12 @@ static void __init sparse_init_nid(int nid, unsigned long pnum_begin,\n \n \t\tms = __nr_to_section(pnum);\n \t\tif (!preinited_vmemmap_section(ms)) {\n+\t\t\tstruct page *map;\n+\n \t\t\tmap = __populate_section_memmap(pfn, PAGES_PER_SECTION,\n-\t\t\t\t\tnid, NULL, NULL);\n-\t\t\tif (!map) {\n-\t\t\t\tpr_err(\"%s: node[%d] memory map backing failed. Some memory will not be available.\",\n-\t\t\t\t __func__, nid);\n-\t\t\t\tpnum_begin = pnum;\n-\t\t\t\tsparse_usage_fini();\n-\t\t\t\tsparse_buffer_fini();\n-\t\t\t\tgoto failed;\n-\t\t\t}\n+\t\t\t\t\t\t\tnid, NULL, NULL);\n+\t\t\tif (!map)\n+\t\t\t\tpanic(\"Populate section (%ld) on node[%d] failed\\n\", pnum, nid);\n \t\t\tmemmap_boot_pages_add(DIV_ROUND_UP(PAGES_PER_SECTION * sizeof(struct page),\n \t\t\t\t\t\t\t PAGE_SIZE));\n \t\t\tsparse_init_early_section(nid, map, pnum, 0);\n@@ -391,19 +383,6 @@ static void __init sparse_init_nid(int nid, unsigned long pnum_begin,\n \t}\n \tsparse_usage_fini();\n \tsparse_buffer_fini();\n-\treturn;\n-failed:\n-\t/*\n-\t * We failed to allocate, mark all the following pnums as not present,\n-\t * except the ones already initialized earlier.\n-\t */\n-\tfor_each_present_section_nr(pnum_begin, pnum) {\n-\t\tif (pnum >= pnum_end)\n-\t\t\tbreak;\n-\t\tms = __nr_to_section(pnum);\n-\t\tif (!preinited_vmemmap_section(ms))\n-\t\t\tms->section_mem_map = 0;\n-\t}\n }\n \n /*\n", "prefixes": [ "09/49" ] }