get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2222549,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2222549/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/20260412174334.3111385-7-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": "<20260412174334.3111385-7-wangrui@loongson.cn>",
    "list_archive_url": null,
    "date": "2026-04-12T17:43:34",
    "name": "[v9,6/6] elf: Add test for THP alignment of large load segments",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "37fcc2224c9a73959be9e0cf310afc7b2b78e6f3",
    "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/20260412174334.3111385-7-wangrui@loongson.cn/mbox/",
    "series": [
        {
            "id": 499622,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/499622/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=499622",
            "date": "2026-04-12T17:43:29",
            "name": "elf: THP-aware load segment alignment",
            "version": 9,
            "mbox": "http://patchwork.ozlabs.org/series/499622/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2222549/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2222549/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 4ftyfT67rmz1yGg\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 03:47:13 +1000 (AEST)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id AD6664BA2E1C\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 12 Apr 2026 17:47:11 +0000 (GMT)",
            "from mail.loongson.cn (mail.loongson.cn [114.242.206.163])\n by sourceware.org (Postfix) with ESMTP id A77624BA23CA\n for <libc-alpha@sourceware.org>; Sun, 12 Apr 2026 17:44:34 +0000 (GMT)",
            "from loongson.cn (unknown [223.64.120.66])\n by gateway (Coremail) with SMTP id _____8CxH6r_2dtpIYUkAA--.41319S3;\n Mon, 13 Apr 2026 01:44:31 +0800 (CST)",
            "from localhost (unknown [223.64.120.66])\n by front1 (Coremail) with SMTP id qMiowJBxZcD52dtpr51rAA--.37956S2;\n Mon, 13 Apr 2026 01:44:30 +0800 (CST)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org AD6664BA2E1C",
            "OpenDKIM Filter v2.11.0 sourceware.org A77624BA23CA"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org A77624BA23CA",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org A77624BA23CA",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776015875; cv=none;\n b=nzTbXtuwdkZ4NzMa5TbqXz9Qz294oCejPz2IOPkPsIkKNCJV84WJIVwnVNzFMQmFpk3oWLDpnjFdUO7j5PX+PVPRvTmUHz+O+2ZV4uc3yvlaVwxelb1o6n4UfcX2v3nvrfDha+uKFpCYjyHemyeFZDPrQj7odPvqNtmIVdQ1AnA=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776015875; c=relaxed/simple;\n bh=HBGzj64j8R1WBLsbkqdLavV/hyptR4kW49EPl8YwvUE=;\n h=From:To:Subject:Date:Message-ID:MIME-Version;\n b=ScYlnwIxUmDell7cCwMwzMLnYrs+809IrgsulCCbJfcOMx0iRn5mZ15vQjk+KfB58c0K8AY4OYblAShRPlLhkkWQHDgG8L8Bmgf/Z+mqiZa800lJqkEiBiimyRxWogtfHdw020QM5YKibAXSp5kJXKFGjz4/1xsPx/TbIU2QNK0=",
        "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 v9 6/6] elf: Add test for THP alignment of large load segments",
        "Date": "Mon, 13 Apr 2026 01:43:34 +0800",
        "Message-ID": "<20260412174334.3111385-7-wangrui@loongson.cn>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260412174334.3111385-1-wangrui@loongson.cn>",
        "References": "<20260412174334.3111385-1-wangrui@loongson.cn>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-CM-TRANSID": "qMiowJBxZcD52dtpr51rAA--.37956S2",
        "X-CM-SenderInfo": "pzdqw2txl6z05rqj20fqof0/",
        "X-Coremail-Antispam": "1Uk129KBj93XoWxKF15Wr4DJry5Wr4DKr4rJFc_yoW3Xry8pF\n Z8CFW5Cr4rGrW5CFWfWF18WFn8ZFn3Gr1Ykry5GF4kCwn8t3yUuFsF9FW5WryfGr95Wr45\n AFWDZFnrWrWrAagCm3ZEXasCq-sJn29KB7ZKAUJUUUU7529EdanIXcx71UUUUU7KY7ZEXa\n sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU\n 0xBIdaVrnRJUUUBSb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2\n IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v\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 7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUIGNtUUUUU",
        "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": "Add a new test to verify that large executable PT_LOAD segments are\nmapped at addresses aligned to the THP size when the glibc tunable\nglibc.elf.thp=1 is enabled and the system is configured to use THP\nin \"always\" mode.\n\nThe test loads a shared object with a sufficiently large executable\nsegment via dlopen and inspects /proc/self/maps to check that the\nmapping address is aligned to the THP page size reported by the kernel.\n\nThe test is skipped if the THP size cannot be determined or if THP is\nnot enabled in \"always\" mode.\n\nSigned-off-by: WANG Rui <wangrui@loongson.cn>\n---\n sysdeps/unix/sysv/linux/Makefile           |   7 +-\n sysdeps/unix/sysv/linux/tst-thp-align.c    | 149 +++++++++++++++++++++\n sysdeps/unix/sysv/linux/tst-thp-size-mod.S |  22 +++\n 3 files changed, 176 insertions(+), 2 deletions(-)\n create mode 100644 sysdeps/unix/sysv/linux/tst-thp-align.c\n create mode 100644 sysdeps/unix/sysv/linux/tst-thp-size-mod.S",
    "diff": "diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile\nindex 9879fec9a93..6e237dd4934 100644\n--- a/sysdeps/unix/sysv/linux/Makefile\n+++ b/sysdeps/unix/sysv/linux/Makefile\n@@ -695,19 +695,22 @@ install-bin += \\\n \n $(objpfx)pldd: $(objpfx)xmalloc.o\n \n-tests += tst-rseq-tls-range tst-rseq-tls-range-4096\n+tests += tst-rseq-tls-range tst-rseq-tls-range-4096 tst-thp-align\n tests-static += tst-rseq-tls-range-static tst-rseq-tls-range-4096-static\n-modules-names += tst-rseq-tls-range-mod\n+modules-names += tst-rseq-tls-range-mod tst-thp-size-mod\n CFLAGS-tst-rseq-tls-range.c += -DMAIN_TLS_ALIGN=4\n CFLAGS-tst-rseq-tls-range-4096.c += -DMAIN_TLS_ALIGN=4096\n CFLAGS-tst-rseq-tls-range-static.c += -DMAIN_TLS_ALIGN=4\n CFLAGS-tst-rseq-tls-range-4096-static.c += -DMAIN_TLS_ALIGN=4096\n+LDFLAGS-tst-thp-size-mod.so += -Wl,-z,noseparate-code\n $(objpfx)tst-rseq-tls-range.out: $(objpfx)tst-rseq-tls-range-mod.so\n $(objpfx)tst-rseq-tls-range-4096.out: $(objpfx)tst-rseq-tls-range-mod.so\n $(objpfx)tst-rseq-tls-range-static.out: $(objpfx)tst-rseq-tls-range-mod.so\n $(objpfx)tst-rseq-tls-range-4096-static.out: $(objpfx)tst-rseq-tls-range-mod.so\n tst-rseq-tls-range-static-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx)\n tst-rseq-tls-range-4096-static-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx)\n+tst-thp-align-ENV = GLIBC_TUNABLES=glibc.elf.thp=1\n+tst-thp-align-modules = tst-thp-size-mod\n \n test-internal-extras += tst-nolink-libc\n ifeq ($(run-built-tests),yes)\ndiff --git a/sysdeps/unix/sysv/linux/tst-thp-align.c b/sysdeps/unix/sysv/linux/tst-thp-align.c\nnew file mode 100644\nindex 00000000000..ec0a8d84a85\n--- /dev/null\n+++ b/sysdeps/unix/sysv/linux/tst-thp-align.c\n@@ -0,0 +1,149 @@\n+/* Test the THP compatible alignment of PT_LOAD segments.\n+\n+   Copyright (C) 2026 Free Software Foundation, Inc.\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+#include <fcntl.h>\n+#include <stdio.h>\n+#include <stdint.h>\n+#include <stdlib.h>\n+#include <string.h>\n+#include <intprops.h>\n+#include <inttypes.h>\n+#include <support/check.h>\n+#include <support/xdlfcn.h>\n+#include <support/xstdio.h>\n+#include <support/xunistd.h>\n+\n+#define THP_SIZE_MOD_NAME \"tst-thp-size-mod.so\"\n+\n+enum thp_mode_t\n+{\n+  thp_mode_always,\n+  thp_mode_madvise,\n+  thp_mode_never,\n+  thp_mode_not_supported\n+};\n+\n+static unsigned long int\n+get_thp_size (void)\n+{\n+  int fd = open (\"/sys/kernel/mm/transparent_hugepage/hpage_pmd_size\",\n+                 O_RDONLY, 0);\n+  if (fd == -1)\n+    return 0;\n+\n+  char str[INT_BUFSIZE_BOUND (unsigned long int)];\n+  ssize_t s = read (fd, str, sizeof (str));\n+  close (fd);\n+  if (s < 0)\n+    return 0;\n+\n+  unsigned long int r = 0;\n+  for (ssize_t i = 0; i < s; i++)\n+    {\n+      if (str[i] == '\\n')\n+    break;\n+      r *= 10;\n+      r += str[i] - '0';\n+    }\n+  return r;\n+}\n+\n+static enum thp_mode_t\n+get_thp_mode (void)\n+{\n+  int fd = open (\"/sys/kernel/mm/transparent_hugepage/enabled\", O_RDONLY, 0);\n+  if (fd == -1)\n+    return thp_mode_not_supported;\n+\n+  static const char mode_always[]  = \"[always] madvise never\\n\";\n+  static const char mode_madvise[] = \"always [madvise] never\\n\";\n+  static const char mode_never[]   = \"always madvise [never]\\n\";\n+\n+  char str[sizeof(mode_always)];\n+  ssize_t s = read (fd, str, sizeof (str));\n+  if (s >= sizeof str || s < 0)\n+    return thp_mode_not_supported;\n+  str[s] = '\\0';\n+  close (fd);\n+\n+  if (s == sizeof (mode_always) - 1)\n+    {\n+      if (strcmp (str, mode_always) == 0)\n+    return thp_mode_always;\n+      else if (strcmp (str, mode_madvise) == 0)\n+    return thp_mode_madvise;\n+      else if (strcmp (str, mode_never) == 0)\n+    return thp_mode_never;\n+    }\n+  return thp_mode_not_supported;\n+}\n+\n+static void\n+check_align (void)\n+{\n+  unsigned long int thp_size = get_thp_size ();\n+  enum thp_mode_t thp_mode = get_thp_mode ();\n+\n+  if (thp_size == 0)\n+    {\n+      printf (\"Skipping test: unable to get THP size.\\n\");\n+      return;\n+    }\n+\n+  if (thp_mode != thp_mode_always)\n+    {\n+      printf (\"Skipping test: THP mode is not always.\\n\");\n+      return;\n+    }\n+\n+  FILE *f = xfopen (\"/proc/self/maps\", \"r\");\n+  char *line = NULL;\n+  size_t len;\n+\n+  while (xgetline (&line, &len, f))\n+    {\n+      uintptr_t from, to;\n+      char *prot = NULL, *path = NULL;\n+      int r = sscanf (line, \"%\" SCNxPTR \"-%\" SCNxPTR \"%ms%*s%*s%*s%ms\",\n+                      &from, &to, &prot, &path);\n+\n+      TEST_VERIFY (r == 3 || r == 4);\n+\n+      if (strstr (prot, \"x\") && strstr (path, THP_SIZE_MOD_NAME))\n+        TEST_COMPARE (from % thp_size, 0);\n+\n+      free (path);\n+    }\n+\n+  free (line);\n+  xfclose (f);\n+}\n+\n+static int\n+do_test (void)\n+{\n+  void *dl;\n+\n+  dl = xdlopen (THP_SIZE_MOD_NAME, RTLD_NOW);\n+  check_align ();\n+  xdlclose (dl);\n+\n+  return 0;\n+}\n+\n+#include <support/test-driver.c>\ndiff --git a/sysdeps/unix/sysv/linux/tst-thp-size-mod.S b/sysdeps/unix/sysv/linux/tst-thp-size-mod.S\nnew file mode 100644\nindex 00000000000..3084c2d0e2c\n--- /dev/null\n+++ b/sysdeps/unix/sysv/linux/tst-thp-size-mod.S\n@@ -0,0 +1,22 @@\n+/* A module that provides THP code size for testing.\n+\n+   Copyright (C) 2026 Free Software Foundation, Inc.\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+    .globl thp_size\n+thp_size:\n+    .space 32 * 1024 * 1024\n",
    "prefixes": [
        "v9",
        "6/6"
    ]
}