Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2219876/?format=api
{ "id": 2219876, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2219876/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/20260405035555.558396-2-wangrui@loongson.cn/", "project": { "id": 41, "url": "http://patchwork.ozlabs.org/api/1.2/projects/41/?format=api", "name": "GNU C Library", "link_name": "glibc", "list_id": "libc-alpha.sourceware.org", "list_email": "libc-alpha@sourceware.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260405035555.558396-2-wangrui@loongson.cn>", "list_archive_url": null, "date": "2026-04-05T03:55:55", "name": "[v8,6/6] loongarch: Enable THP-aligned load segments by default on 64-bit", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "63762563629e972f42b6e9895afc7581372fa4ef", "submitter": { "id": 85150, "url": "http://patchwork.ozlabs.org/api/1.2/people/85150/?format=api", "name": "WANG Rui", "email": "wangrui@loongson.cn" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/20260405035555.558396-2-wangrui@loongson.cn/mbox/", "series": [ { "id": 498763, "url": "http://patchwork.ozlabs.org/api/1.2/series/498763/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=498763", "date": "2026-04-05T03:53:16", "name": "elf: THP-aware load segment alignment", "version": 8, "mbox": "http://patchwork.ozlabs.org/series/498763/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2219876/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2219876/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "libc-alpha@sourceware.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "libc-alpha@sourceware.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n dmarc=none (p=none dis=none) header.from=loongson.cn", "sourceware.org; spf=pass smtp.mailfrom=loongson.cn", "server2.sourceware.org;\n arc=none smtp.remote-ip=114.242.206.163" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fpJYg39MMz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 05 Apr 2026 13:56:55 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 622164BA2E39\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 5 Apr 2026 03:56:53 +0000 (GMT)", "from mail.loongson.cn (mail.loongson.cn [114.242.206.163])\n by sourceware.org (Postfix) with ESMTP id 119B34BA2E24\n for <libc-alpha@sourceware.org>; Sun, 5 Apr 2026 03:56:31 +0000 (GMT)", "from loongson.cn (unknown [223.64.120.66])\n by gateway (Coremail) with SMTP id _____8BxUcBt3dFpzRgiAA--.36704S3;\n Sun, 05 Apr 2026 11:56:29 +0800 (CST)", "from localhost (unknown [223.64.120.66])\n by front1 (Coremail) with SMTP id qMiowJBxrsJo3dFpj1JlAA--.45307S3;\n Sun, 05 Apr 2026 11:56:28 +0800 (CST)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 622164BA2E39", "OpenDKIM Filter v2.11.0 sourceware.org 119B34BA2E24" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 119B34BA2E24", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 119B34BA2E24", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775361392; cv=none;\n b=g9ALDytfWCDvpGHoBwm29tXjxaEY5CauTBY+fyMaxjmc24wzqr6JdHyQWQsd+7K2NsTsdaoKVGKUb/Go5qr5ljiNfOiE6xK2RVVBi2i28/7YXquxelFFiN8jgxALKdvqhPgnIsBJeKAA+7q6YWiyj5UhMqDsWv3szoKYgGgPk3Y=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1775361392; c=relaxed/simple;\n bh=eZHFaLBd7oXRxrYYGmvQftnnh8LTLsZDZfT/vdpUyeQ=;\n h=From:To:Subject:Date:Message-ID:MIME-Version;\n b=Pp6Nf4qf0owYyZG/wjCcJMsISVy74Atduk0lyxK/vpIWjrWwHXh7ELhqcWycRca6n0VWJoqPjGFKuu7JR45fAwM3lt2p/xOm4HoSgZ03WxVEAeUQnfLaTJF7xlLvKzFZUt/I/0CdVGS0uodifhUpTNt+YjqsYhHizHK6mGfYjZk=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "From": "WANG Rui <wangrui@loongson.cn>", "To": "libc-alpha@sourceware.org", "Cc": "Adhemerval Zanella <adhemerval.zanella@linaro.org>,\n Dev Jain <dev.jain@arm.com>, Florian Weimer <fweimer@redhat.com>,\n Wilco Dijkstra <Wilco.Dijkstra@arm.com>, Xi Ruoyao <xry111@xry111.site>,\n WANG Xuerui <git@xen0n.name>, caiyinyu <caiyinyu@loongson.cn>,\n mengqinggang <mengqinggang@loongson.cn>,\n Huacai Chen <chenhuacai@kernel.org>, hjl.tools@gmail.com,\n WANG Rui <wangrui@loongson.cn>", "Subject": "[PATCH v8 6/6] loongarch: Enable THP-aligned load segments by default\n on 64-bit", "Date": "Sun, 5 Apr 2026 11:55:55 +0800", "Message-ID": "<20260405035555.558396-2-wangrui@loongson.cn>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260405035555.558396-1-wangrui@loongson.cn>", "References": "<20260405035323.558335-1-wangrui@loongson.cn>\n <20260405035555.558396-1-wangrui@loongson.cn>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-CM-TRANSID": "qMiowJBxrsJo3dFpj1JlAA--.45307S3", "X-CM-SenderInfo": "pzdqw2txl6z05rqj20fqof0/", "X-Coremail-Antispam": "1Uk129KBj93XoWxCw1UXw43KF1fGr4rtw1xXrc_yoWrWr1Upr\n WakFs5CF4rWr17C3yak3W7Z3W5WF4rCFs8Cr9xCw4UZryUJr1xZFsFyF1fJFy7J3yxGF4x\n uFnFq3WDuF1rAacCm3ZEXasCq-sJn29KB7ZKAUJUUUU7529EdanIXcx71UUUUU7KY7ZEXa\n sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU\n 0xBIdaVrnRJUUUBSb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2\n IYs7xG6rWj6s0DM7CIcVAFz4kK6r126r13M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v\n e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI\n 0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVCY1x0267AK\n xVW8JVW8Jr1ln4kS14v26r1Y6r17M2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12\n xvs2x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26rWY\n 6Fy7McIj6I8E87Iv67AKxVWxJVW8Jr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7V\n AKI48JMxkF7I0En4kS14v26r126r1DMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY\n 6r1j6r4UMxCIbckI1I0E14v26r1Y6r17MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7\n xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xII\n jxv20xvE14v26F1j6w1UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWxJVW8Jr1lIxAIcVCF04\n k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26F4j6r4UJwCI42IY6I8E87Iv6xkF\n 7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUIeHqUUUUU", "X-BeenThere": "libc-alpha@sourceware.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Libc-alpha mailing list <libc-alpha.sourceware.org>", "List-Unsubscribe": "<https://sourceware.org/mailman/options/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe>", "List-Archive": "<https://sourceware.org/pipermail/libc-alpha/>", "List-Post": "<mailto:libc-alpha@sourceware.org>", "List-Help": "<mailto:libc-alpha-request@sourceware.org?subject=help>", "List-Subscribe": "<https://sourceware.org/mailman/listinfo/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=subscribe>", "Errors-To": "libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org" }, "content": "On LoongArch64 Linux, aligning ELF load segments to Transparent Huge Page\n(THP) boundaries provides consistent performance benefits for large\nbinaries by reducing TLB pressure and improving instruction fetch\nefficiency.\n\nEnable THP-based load segment alignment by default on LoongArch64 by\nsetting `glibc.elf.thp=1` during startup. Define the default THP\npage size for load segment alignment on LoongArch64 as 32MB.\n\nThis allows the dynamic loader to apply THP-friendly alignment without\nrequiring the `glibc.elf.thp` tunable to be explicitly set.\n\nBenchmarks\n\nMachine: Loongson 3A6000 (LoongArch64)\nKernel: 6.18.13\n CONFIG_READ_ONLY_THP_FOR_FS=y\n CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y\n\nWorkload 1: building Cargo 1.93.0\nRustc: nightly-2026-02-26\n\n Without patch With patch\ninstructions 3,690,358,948,176 3,690,301,774,568\ncpu-cycles 4,233,025,766,760 4,035,866,635,741\nitlb-misses 9,708,829,532 2,700,014,717\ntime elapsed 302.40 s 289.68 s\n\nInstructions remain essentially unchanged. iTLB misses drop by about\n72%, reducing CPU cycles by about 4.7% and wall time by about 4.2%.\n\nWorkload 2: building Linux kernel v7.0-rc1\nLLVM: 21.1.8\n\n Without patch With patch\ninstructions 14,163,739,876,387 14,169,418,598,675\ncpu-cycles 19,231,890,317,741 16,851,494,928,181\nitlb-misses 91,142,010,440 90,779,245\ntime elapsed 1022.09 s 893.22 s\n\nInstructions remain roughly the same. iTLB misses drop from about 91B\nto about 90M (roughly 99.9% reduction), reducing CPU cycles by about\n12% and wall time by about 12.6%.\n\nReviewed-by: caiyinyu <caiyinyu@loongson.cn>\nSigned-off-by: WANG Rui <wangrui@loongson.cn>\n---\n .../unix/sysv/linux/loongarch/cpu-features.c | 6 +++++\n .../loongarch/lp64/dl-map-segment-align.h | 22 +++++++++++++++++++\n 2 files changed, 28 insertions(+)\n create mode 100644 sysdeps/unix/sysv/linux/loongarch/lp64/dl-map-segment-align.h", "diff": "diff --git a/sysdeps/unix/sysv/linux/loongarch/cpu-features.c b/sysdeps/unix/sysv/linux/loongarch/cpu-features.c\nindex 0c125e64e2b..7ed54ff53e7 100644\n--- a/sysdeps/unix/sysv/linux/loongarch/cpu-features.c\n+++ b/sysdeps/unix/sysv/linux/loongarch/cpu-features.c\n@@ -27,4 +27,10 @@ init_cpu_features (struct cpu_features *cpu_features)\n GLRO(dl_larch_cpu_features).hwcap = GLRO(dl_hwcap);\n TUNABLE_GET (glibc, cpu, hwcaps, tunable_val_t *,\n \t TUNABLE_CALLBACK (set_hwcaps));\n+\n+#ifdef __LP64__\n+ /* Enable THP-based load segment alignment by default on LoongArch64. */\n+ if (!TUNABLE_IS_INITIALIZED (glibc, elf, thp))\n+ TUNABLE_SET (glibc, elf, thp, 1);\n+#endif\n }\ndiff --git a/sysdeps/unix/sysv/linux/loongarch/lp64/dl-map-segment-align.h b/sysdeps/unix/sysv/linux/loongarch/lp64/dl-map-segment-align.h\nnew file mode 100644\nindex 00000000000..c51ee4ac47e\n--- /dev/null\n+++ b/sysdeps/unix/sysv/linux/loongarch/lp64/dl-map-segment-align.h\n@@ -0,0 +1,22 @@\n+/* _dl_map_segment_align. LoongArch64 Linux version.\n+ Copyright (C) 2026 Free Software Foundation, Inc.\n+ Copyright The GNU Toolchain Authors.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <https://www.gnu.org/licenses/>. */\n+\n+#define DL_MAP_DEFAULT_THP_PAGESIZE (32 * 1024 * 1024)\n+\n+#include_next <dl-map-segment-align.h>\n", "prefixes": [ "v8", "6/6" ] }