Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2219946/?format=api
{ "id": 2219946, "url": "http://patchwork.ozlabs.org/api/patches/2219946/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260405125240.2558577-22-songmuchun@bytedance.com/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/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-22-songmuchun@bytedance.com>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20260405125240.2558577-22-songmuchun@bytedance.com/", "date": "2026-04-05T12:52:12", "name": "[21/49] mm/sparse: drop power-of-2 size requirement for struct mem_section", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "409b98589544d06f0cb8dd78705786b602030bf4", "submitter": { "id": 78930, "url": "http://patchwork.ozlabs.org/api/people/78930/?format=api", "name": "Muchun Song", "email": "songmuchun@bytedance.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260405125240.2558577-22-songmuchun@bytedance.com/mbox/", "series": [ { "id": 498783, "url": "http://patchwork.ozlabs.org/api/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/2219946/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2219946/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linuxppc-dev+bounces-19351-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=lw74I0n3;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=112.213.38.117; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-19351-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::102d\"", "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=lw74I0n3;\n\tdkim-atps=neutral", "lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=bytedance.com\n (client-ip=2607:f8b0:4864:20::102d; helo=mail-pj1-x102d.google.com;\n envelope-from=songmuchun@bytedance.com; receiver=lists.ozlabs.org)" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117])\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 4fpXWX1NWnz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 05 Apr 2026 22:55:52 +1000 (AEST)", "from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4fpXWL2SZ7z2ysZ;\n\tSun, 05 Apr 2026 22:55:42 +1000 (AEST)", "from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com\n [IPv6:2607:f8b0:4864:20::102d])\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 4fpXWK39H7z2yrm\n\tfor <linuxppc-dev@lists.ozlabs.org>; Sun, 05 Apr 2026 22:55:41 +1000 (AEST)", "by mail-pj1-x102d.google.com with SMTP id\n 98e67ed59e1d1-35da9692ec3so2875527a91.1\n for <linuxppc-dev@lists.ozlabs.org>;\n Sun, 05 Apr 2026 05:55:41 -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.55.34\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 05 Apr 2026 05:55:39 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775393742;\n\tcv=none;\n b=YM1rTY6XsmU07HsxHZ5FRAT1hd/bmo0YItWwtjbSOzCEhZdwN7PSME5VE4zyH7vrwQfuWZN14z/MRQOLGWRnh5LJCC+X5tDodvlfyoCEIXx1k6WGwe/FSwSXPGgQuKoj8tXnH0OwjMRKGJ9919gP1q7Nf6yDpoL4SDDCAzjJHUACXCV/EkqrPiDfV+iPRlNFVsuu5pykxvWkk1W6k/8VULuNhlFP1gqbVVT0sS2Rc4J83f4KrXx6IWJ3jdGY39vVOMSRt5pwBaDUcuR2TmSAc+rvc6FcAkjg4J6RplrgTfgDlkQvjKIxIdNn/Lvxq65/xEiLLIh4amWT/LdgpkZhhQ==", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1775393742; c=relaxed/relaxed;\n\tbh=RosLEkDdV2Cdz9XETYo2dsVY+zgApycOz9SAkpm7hvM=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=DGLp9KjAhmRxkpaxDG3u4NZC6U7ZBEBoZUqpO6atzQ+RycsCcbXd+yKAVJHUcWvKWDBQlZkSFeZsve4F/Jpb66B4Cm6aMd2EC2G82BaZI2D0J7v9zpdzQ6xv7/aeZkmM8s6Bw4cjucy8LOh28y3EplcZPz7SsAbaMQuJlEfM5EnbD+iok8XTbuOT7JW3CvwYpMmgUuhU5TChhnyUhueXylZluF2ZMes4TrjdIei3UnlWuCNiSBIDseufTkIoe+bXWUrDfP0Rxz/6fbkQAI+3+ooLHeWnaXvJ3eUWqg1BBDNw0pfmY4oWi0ZOaPQhD7gjmGD21/N3zmkT++Li9nW4Qw==", "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=lw74I0n3; dkim-atps=neutral;\n spf=pass (client-ip=2607:f8b0:4864:20::102d; helo=mail-pj1-x102d.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=1775393740; x=1775998540;\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=RosLEkDdV2Cdz9XETYo2dsVY+zgApycOz9SAkpm7hvM=;\n b=lw74I0n3sCba4dEhyonu9CpxlsEXfICCNlth/gRZakCpTpgMPRASgU7QQWFFqSUQ2p\n 42obKFu80a/cBJ+iG0HS5GmKLJEfk1E80ImrZhICQePtVKTlAZOQP8P9n8z0XBXoFReQ\n Sl1SLVnRMF7IvQBLfhzsS6rAq4uiBIGmH6xpXlSjqSYQp7qy+oyzEhMIf11fQ3E/1Z6I\n 2m048deYzq5zzv+SAYHvdBjQm5m9F8AuWBjeZfpQKq3XD14nakqBv5TcEHYK0TGyXDw8\n QUV9l2NglvUseX6azVxasd4SCu9gqpRKQESKTIHzDhIuzbI7NpFFiU5kV6GtR6KTFucs\n 3wkw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775393740; x=1775998540;\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=RosLEkDdV2Cdz9XETYo2dsVY+zgApycOz9SAkpm7hvM=;\n b=aWlerXRo9ghV0BIu8CiPS03xMJhnNdHqrj/FpbuDvl0a6QGSQE6dlbVAbAn3IYP+hG\n MpmRHwe8tumRLIcQOOxAhHAvKKTRqNn4LTMERalK3/EWZj55Z0rtgPM2067TsLb+dwes\n Q9kpwZr76lFroq3ZVkqwPXc1naVjssHoccPbnA6SwkV4HR4eAtdQCdAtuk8EEeVtnsjf\n lquWYjenc0HRoaQb79tpBBdsUa1k/vGRA+D6vbkmEWDCdDiiQva/vfrqSqEcgC5MIML3\n PxLUYAKI9/jrccaoBXNX5zcAagKMwYoOAbV9sKeTxWNSvrfAJvgvIKJr96rMYIlgr1T3\n KKBg==", "X-Forwarded-Encrypted": "i=1;\n AJvYcCWPuF9m+3BXUs2TqHFq3MpBE5V3fpp3nOwfTD1dCZUhcexGMMKA98wYMwlnYzfxYT9uyADBFuCAPedPrSk=@lists.ozlabs.org", "X-Gm-Message-State": "AOJu0YxF8qBEBUx2JlfkcXUbBNqCjF4w8hSHkBmIXio0SQbuk7nS2j6C\n\tt9/PccFb4KJLxUi+aVt3HK2G7S6n2+cpoPA4qZB2XA0RXP/P4QPLiLzZFcCQ0eAtOAM=", "X-Gm-Gg": "AeBDievbH6NA0cGlTHzKerj18KdGlxTy18wYfPKr+FcismeCaugGYhW9qaGDdO+E7Fw\n\twEdhEHXhZqcNvtdJCj5gjFSprJI9wUzcL3wqVa52ppB8tBAp3D9ThdI0DMma5sdSgkBoWYzbi69\n\t61m+7C0J/u55gs2Io+8iotxp6nUQk/HT9XhMygB0g4xD7zwHik9rrnWQDeypBOO0nUGKvMOjjWq\n\t9JeehaLkLFVpEQJF6KpE7xth8fYuZUC1env9atxBOGkuXq1kmAOVCBC+u1wRrS1DJXWAZNEdaLr\n\tVnNs3ntu8N/fvB806LQOHh+z9jshexwb8qJ9nb5zupUHxUicqfbgrG5oyachdvEsgfobnw1Z4fo\n\tPBdofoECP1hSHiUpBc1ONM9wMjKgi/lgZVG+RveBeFWx1u5SpRYgANj9c/CrFKPVfauFYpYCLAL\n\tv+aN7SspacPI7nNUNbJqRTaOPfaRybOKLDVTlGwh0HxYo=", "X-Received": "by 2002:a17:90b:554e:b0:35d:aeb2:25b2 with SMTP id\n 98e67ed59e1d1-35de69780b4mr8868406a91.27.1775393739584;\n Sun, 05 Apr 2026 05:55:39 -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 21/49] mm/sparse: drop power-of-2 size requirement for struct\n mem_section", "Date": "Sun, 5 Apr 2026 20:52:12 +0800", "Message-Id": "<20260405125240.2558577-22-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": "Since sparsemem-extreme was introduced, struct mem_section has been\nforced to a power-of-2 size so that the section-to-root lookup could\nuse a cheap bit-mask instead of an expensive divide:\n\n section = &mem_section[root][nr & SECTION_ROOT_MASK];\n\nThis is enforced at compile time with\n\n BUILD_BUG_ON(!is_power_of_2(sizeof(struct mem_section)));\n\nand forces us to add padding that grows and shrinks with every config\ncombination, wasting memory just to keep the structure aligned to the\nnext power of two. With CONFIG_PAGE_EXTENSION enabled the padding\nalone can reach 42 struct mem_section instances per section-root page.\n\nDrop the requirement and switch to a plain modulo:\n\n section = &mem_section[root][nr % SECTIONS_PER_ROOT];\n\nModern compilers turn the divide into a multiply-by-reciprocal approach,\nso the runtime impact is negligible. In return we get:\n\n1. Immediate memory savings when CONFIG_PAGE_EXTENSION is enabled.\n2. Freedom to extend struct mem_section in the future without having\n to fiddle with artificial padding or the power-of-2 rule.\n\nSigned-off-by: Muchun Song <songmuchun@bytedance.com>\n---\n include/linux/mmzone.h | 8 +-------\n mm/sparse.c | 2 --\n scripts/gdb/linux/mm.py | 6 ++----\n 3 files changed, 3 insertions(+), 13 deletions(-)", "diff": "diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h\nindex 378feaf4e4ed..3e3755666846 100644\n--- a/include/linux/mmzone.h\n+++ b/include/linux/mmzone.h\n@@ -2013,12 +2013,7 @@ struct mem_section {\n \t * section. (see page_ext.h about this.)\n \t */\n \tstruct page_ext *page_ext;\n-\tunsigned long pad;\n #endif\n-\t/*\n-\t * WARNING: mem_section must be a power-of-2 in size for the\n-\t * calculation and use of SECTION_ROOT_MASK to make sense.\n-\t */\n };\n \n #ifdef CONFIG_SPARSEMEM_EXTREME\n@@ -2029,7 +2024,6 @@ struct mem_section {\n \n #define SECTION_NR_TO_ROOT(sec)\t((sec) / SECTIONS_PER_ROOT)\n #define NR_SECTION_ROOTS\tDIV_ROUND_UP(NR_MEM_SECTIONS, SECTIONS_PER_ROOT)\n-#define SECTION_ROOT_MASK\t(SECTIONS_PER_ROOT - 1)\n \n #ifdef CONFIG_SPARSEMEM_EXTREME\n extern struct mem_section **mem_section;\n@@ -2053,7 +2047,7 @@ static inline struct mem_section *__nr_to_section(unsigned long nr)\n \tif (!mem_section || !mem_section[root])\n \t\treturn NULL;\n #endif\n-\treturn &mem_section[root][nr & SECTION_ROOT_MASK];\n+\treturn &mem_section[root][nr % SECTIONS_PER_ROOT];\n }\n extern size_t mem_section_usage_size(void);\n \ndiff --git a/mm/sparse.c b/mm/sparse.c\nindex 5fe0a7e66775..cfe4ffd89baf 100644\n--- a/mm/sparse.c\n+++ b/mm/sparse.c\n@@ -394,8 +394,6 @@ void __init sparse_init(void)\n \tunsigned long pnum_end, pnum_begin, map_count = 1;\n \tint nid_begin;\n \n-\t/* see include/linux/mmzone.h 'struct mem_section' definition */\n-\tBUILD_BUG_ON(!is_power_of_2(sizeof(struct mem_section)));\n \tmemblocks_present();\n \n \tif (compound_info_has_mask()) {\ndiff --git a/scripts/gdb/linux/mm.py b/scripts/gdb/linux/mm.py\nindex d78908f6664d..0c9eeed92064 100644\n--- a/scripts/gdb/linux/mm.py\n+++ b/scripts/gdb/linux/mm.py\n@@ -70,7 +70,6 @@ class x86_page_ops():\n self.SECTIONS_PER_ROOT = 1\n \n self.NR_SECTION_ROOTS = DIV_ROUND_UP(self.NR_MEM_SECTIONS, self.SECTIONS_PER_ROOT)\n- self.SECTION_ROOT_MASK = self.SECTIONS_PER_ROOT - 1\n \n try:\n self.SECTION_HAS_MEM_MAP = 1 << int(gdb.parse_and_eval('SECTION_HAS_MEM_MAP_BIT'))\n@@ -100,7 +99,7 @@ class x86_page_ops():\n def __nr_to_section(self, nr):\n root = self.SECTION_NR_TO_ROOT(nr)\n mem_section = gdb.parse_and_eval(\"mem_section\")\n- return mem_section[root][nr & self.SECTION_ROOT_MASK]\n+ return mem_section[root][nr % self.SECTIONS_PER_ROOT]\n \n def pfn_to_section_nr(self, pfn):\n return pfn >> self.PFN_SECTION_SHIFT\n@@ -249,7 +248,6 @@ class aarch64_page_ops():\n self.SECTIONS_PER_ROOT = 1\n \n self.NR_SECTION_ROOTS = DIV_ROUND_UP(self.NR_MEM_SECTIONS, self.SECTIONS_PER_ROOT)\n- self.SECTION_ROOT_MASK = self.SECTIONS_PER_ROOT - 1\n self.SUBSECTION_SHIFT = 21\n self.SEBSECTION_SIZE = 1 << self.SUBSECTION_SHIFT\n self.PFN_SUBSECTION_SHIFT = self.SUBSECTION_SHIFT - self.PAGE_SHIFT\n@@ -304,7 +302,7 @@ class aarch64_page_ops():\n def __nr_to_section(self, nr):\n root = self.SECTION_NR_TO_ROOT(nr)\n mem_section = gdb.parse_and_eval(\"mem_section\")\n- return mem_section[root][nr & self.SECTION_ROOT_MASK]\n+ return mem_section[root][nr % self.SECTIONS_PER_ROOT]\n \n def pfn_to_section_nr(self, pfn):\n return pfn >> self.PFN_SECTION_SHIFT\n", "prefixes": [ "21/49" ] }