From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AAF3EC44501 for ; Wed, 15 Jul 2026 18:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=dhgYyHhNx3mFWlfEOgFLcf2FH4tPJUwjwawBC1RyrP0=; b=x+94ynqVPOxFC8HWduycjMzR3x CTeDgKJBAHRunBinfRlqDkNMQdeF/f5ggQPsyJ0X9eqtniatbNclMsDFyURFQigyaAU4kOFdPRZcK +g+Cg0tgijmWbwrQeu+w2xP6g541VkiYqs3g6OXsUfObhy4krNfthY6au5KH3BtMIeREVEJEs8bMW ciIaMhC4obyLNtyOHke3zzzP8a2RQ5Obr6AM7GZr5pxRKAAm+ve05lpSkiAFAHRBwcu9AfOEM0wa+ NmCmmXVs6PnjqaarG5gK9MzcMsUumqOb+M8RPTVSs4yfeDDNcBk47sBHjynKUdGH2c/sYgDHTYwh9 TtcILHxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wk3zO-0000000FcIc-1s9f; Wed, 15 Jul 2026 18:05:47 +0000 Received: from mail-centralusazon11020137.outbound.protection.outlook.com ([52.101.61.137] helo=DM1PR04CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wk3zL-0000000FcHk-2ABM for linux-arm-kernel@lists.infradead.org; Wed, 15 Jul 2026 18:05:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MIzyEPXomQYUafbCmTm066o8wMu3Htf7bgPS4Ep2ufxTQlN7eZt8P9spCyrOWcgJ1pQGZX+k753f2htrMjXduwClzqo11FbP6iC2YW5tqUA0d4RTYRna1wf6OI/liqZZUoB6rJ0yXJYkTsaSVusHK7AN+Bt81ZeZYvEoK7G0K4t3VIfU9bIJRBWFuZn5l/81LcvBf2zTU0nXB0vzxjb5x+TUySubapCundyw1mXTKMpdbXyRb9bRn+x9F+ePH1cw+0YT4Q1EbzN1kkbl/CIeI/X0zPBnA0KfhlBDTIbjEShE7F7ukHanmuuOoLyL910Sn6Nxyuyi0kXUJF381c81bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dhgYyHhNx3mFWlfEOgFLcf2FH4tPJUwjwawBC1RyrP0=; b=c54Q9q6QLt3Yue+IEd+8aIEkWzP2dTn1l29r0ku1eqyUHaMbZtGQB/7JaYP76zicSTcdcOHK3Vube7qear4F1JeLdpaP+br6mlhTM+W7UTbW5yQUZg9Z3NijbINrUih6yWEcZJMPP2RziHVXI46rubtDjXCrh/0HxIN0Q8z5swKNMQUXfxYTVYw/w9cQIZAJIf5fR1nCgZ2b/CuCfwgGuJYy7pNNK91VI8QH7Oo7mwsJw5NYEeckHHgYd5nVkpi6GIbN50lHF+VSyHaXik52k6dS+Z1Ez4jpPgOz6PRgVnYWQ5CT2Yh9V4A49y8l/lzv5jzaGkUtLIde+JjpPeNDuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dhgYyHhNx3mFWlfEOgFLcf2FH4tPJUwjwawBC1RyrP0=; b=CxijXkxUzn+9shMOcPz5otcULHjqGMKRIQiyBObOVBWqrf7KHQ1hyBGaEIO+7SKm+diwrjDiBYAEgYZstBNze0wu/vFq8vsSkJrwcNewJam7HU2afSdJ9RpDMUDu6e7St290FrOi2fQxXWrjmgxgKVi6K2rL+8sh5uxdiQ/HkYg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from CH0PR01MB6873.prod.exchangelabs.com (2603:10b6:610:112::22) by SJ0PR01MB6207.prod.exchangelabs.com (2603:10b6:a03:29d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.12; Wed, 15 Jul 2026 18:05:32 +0000 Received: from CH0PR01MB6873.prod.exchangelabs.com ([fe80::46eb:64a3:667c:c1a0]) by CH0PR01MB6873.prod.exchangelabs.com ([fe80::46eb:64a3:667c:c1a0%3]) with mapi id 15.21.0223.008; Wed, 15 Jul 2026 18:05:31 +0000 From: Yang Shi To: cl@gentwo.org, dennis@kernel.org, tj@kernel.org, urezki@gmail.com, catalin.marinas@arm.com, will@kernel.org, ryan.roberts@arm.com, david@kernel.org, akpm@linux-foundation.org, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com Cc: yang@os.amperecomputing.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC v2 PATCH 0/16] Optimize this_cpu_*() ops for non-x86 (ARM64 for this series) Date: Wed, 15 Jul 2026 11:04:02 -0700 Message-ID: <20260715180455.515692-1-yang@os.amperecomputing.com> X-Mailer: git-send-email 2.52.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: CYZPR05CA0010.namprd05.prod.outlook.com (2603:10b6:930:89::18) To CH0PR01MB6873.prod.exchangelabs.com (2603:10b6:610:112::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR01MB6873:EE_|SJ0PR01MB6207:EE_ X-MS-Office365-Filtering-Correlation-Id: b735caa3-519c-4802-de73-08dee29ba909 X-MS-Exchange-AtpMessageProperties: SA X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|23010399003|1800799024|366016|56012099006|11063799006|6133799003|3023799007|55112099003|18002099003|10067099003|921020; X-Microsoft-Antispam-Message-Info: TbBw/NGl1kmTmAiqZ+GPTPXsv3UUYtCzUZIqQl3e/yF6SYuWbPaPdQqaL4yFApGgvadEYzi1+lyfOv25SuMl2YYW/dsXSxfHvdRTvDMMjRPUBkZDG8tTOCySDNqUGIUPo8t/JCtR1AcXcP/dHYRgTM1DEjzpCtc01dfq7aoA9Em30nj2KTeeSLdJcC4pa/C1H+xsoBKywYzACsMXeGyAVdjTJtRm/2sVhg899yw651eSYdOaNz0X4z1mxn2+N5j7kollfm89Fc0gWg5J9d/jYKRWV/q9LcEYTsNnDDrQ6PpranQ78h6odaoFiXvboApkXGnGV2zSeyVNOWS2QyPRQyUIlMhd/hwG3Kfkf1xt6u39lhykoa2zhkCiL1hMiWY5hCSufBvN+brZQvB1dQlI7J706PemDqBH60PSA2CV47jOgv+zfJtNU52WO4U0Qg9xbalquRRAXs2e5v90tYPw2uE8x7IaVUuXqIzTfeeYFThzPFueKQsm3XbRZyzjCZBZ7bqoiBrIlldIw/nKBQkgezCFHzsjQ8w2I2vHBJSZaxeUzD9MVm8YmikV5Nzk8RtZiFwtAXQGsi3qaO7HqA3SdE8grM8GhvZZhwN/s/F3uVVun8lRJ8crAdlU+wbTWzX4Rxh2Slp8h3Tw1Kx/HMoofbA9uTiRsCbsec4p9WUgcxgqNZ1f4wC1w8Mmri2+u5V762fcDSaSSqYidna6pqkqPw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR01MB6873.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(23010399003)(1800799024)(366016)(56012099006)(11063799006)(6133799003)(3023799007)(55112099003)(18002099003)(10067099003)(921020);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VHovQUFLTEVENThab2ZsNVBvNG9rdlNER2tYdEM0QURJWkhicEVWTWl0V0VC?= =?utf-8?B?TCt2UDNmaHhjbUJJMUdFNkRkUS8zeEdZSU04MWY0TGNYbVE1MGRHM1VCWHpi?= =?utf-8?B?Z3ZUM0FNTU5JTVg5SmxNU2wyQjhIQXBxWmhoY2dCdU5BRURXTFZoZVFIYk9i?= =?utf-8?B?Nkw2anRUcDlyOWpRWHdodzNJNDlLTm9WekgvTWtUUTgxZE0xdm02Mm1VellY?= =?utf-8?B?RVdUbHdqd0NJbEJBdWtzNHVINTZmOGFxOXh0NFg3OXYxS0VrT0ptbWdoa0gw?= =?utf-8?B?bllVUmQ5M2VWTmpmRmdMelBBaDc3VGtjMVA2RDIxblc1ZERsTXVWWlNJaHI4?= =?utf-8?B?M3lzNTI4bXJ1R201cGl6Mjh4R0VWa1JCUUFPV1AzOFNLZFhJRjZDeTFGRzBZ?= =?utf-8?B?K1gwSzI0TTh5anJGN0ZIdWxaU0xvb3ZkdHREQlhmYi9wc3dNdnhGVGduenMx?= =?utf-8?B?NFNCRG5HbGxHWTRjRE9YTFdMYkh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NyUnFlRHBqSnJr?= =?utf-8?B?TnR4OTdRU1g5Y1hUTzVyRXhQSTdIN2g1SVVkMkR3cnVNZXpuc3J5clVXaGVG?= =?utf-8?Q?Epktc37p92Y60tJc=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: b735caa3-519c-4802-de73-08dee29ba909 X-MS-Exchange-CrossTenant-AuthSource: CH0PR01MB6873.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2026 18:05:31.8710 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KvgL6JDpzeNRXVL1Qlgj5uCdldwTuELpObMI5h0BQ5iLgOCbUjpSU6a+7g3ZKtgUJkxQWBrFAQVN+gDY/NfMYTJ54Uh2UtKGQVvloD/fK3A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR01MB6207 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260715_110543_647594_8EF9EC9D X-CRM114-Status: GOOD ( 27.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, This is v2 RFC. In v2 a lot problems found out by Sashiko were fixed and more feature gaps were closed (please see the below changelog for the details). Although there are still some open issues, for example, it just can support 48 bits VA (for 4K and 64K) and 47 bits VA (for 16K), KPTI support has not been solved yet, etc, but I think the delta should be big enough and worth a new RFC to gather comments in order to make sure I'm on the right track. Some more benchmarks were done, for example, some latency related benchmarks that I mentioned at LSFMM because I thought responsiveness should be improved due to the removal of preempt_disable. Collected more PMU counters as well. Please refer to the benchmark section for more details. Look forward to comments. Changelog v2: * Added 3-level and 2-level page table support. * Tested with 16K and 64K page size. But we just support 48 bits VA (4K and 64K) and 47 bits VA with 16K for now. Please refer to the below "known issue" section for the detail reason. * Added support for memory hotplug. * Added support for KASAN (generic). * Treated percpu and local percpu area address as vmalloc address. * Fixed build failure for x86. * Fixed build failure for !CONFIG_NUMA. * Added KASAN support for local percpu area. * Some other misc bug fixes found out by Sashiko. * More code refactor and cleanup. * Regorganized the patches. * More benchmarks, refer to benchmark section for more details. * Rebased to v7.2-rc1. Introduction ============ This patch series implemented the LSFMM 2026 proposal for optimizing this_cpu_*() ops on ARM64. For the details of the proposal, Please refer to: https://lore.kernel.org/linux-mm/CAHbLzkpcN-T8MH6=W3jCxcFj1gVZp8fRqe231yzZT-rV_E_org@mail.gmail.com/ I didn't repeat it in the cover letter because there is no change to the proposal. The series is based on 7.1-rc1. It is basically minimum viable patches. There are still a few hacks in this series and it may break something, for example, KPTI, SMT machines which shared TLB, etc. But it shoule be good enough for now to demonstrate the core idea. The main purpose of the RFC is to gather feedback, figure out missing parts and risks, and make sure we are on the right track, as well as hopefully it can help the discussion for the upcoming LSFMM. I broke the patches down to arch-dependent and arch-independent parts so that hopefully the interested persons can do experiments on other architectures, for example, S390, easier. A new kernel config is introduced, HAVE_LOCAL_PER_CPU_MAP. The architectures which can support this feature will select it. Allocating and freeing percpu local mapping is protected by this config so that others won't pay the cost. Known Issues ============ 1. KPTI ------- We need determine what CPU we are on, then switch to the right page table. Currently arm64 kernel fetches tramp_pg_dir via swapper_pg_dir - fixed_offset, and fetches swapper_pg_dir from ttbr1. But ttbr1 may not hold swapper_pg_dir anymore except CPU #0. So we need to figure out the other way to handle it. Switching to tramp_pg_dir should be easy, but the reverse seems harder because tramp_pg_dir just maps the trampoline vectors. Maybe we can do two steps switch. Switch to swapper_pg_dir at the first step, then switch to per cpu page table (for entry) or tramp page table (for exit). Nobody should call this_cpu_*() at either userspace -> kernel entry stage or kernel -> userspace exit stage. 2. SW PAN --------- Has the similar issue as KPTI. It installs reserved_pg_dir to TTBR0 when running in kernel space, but fetching reserved_pg_dir via swapper_pg_dir - fixed_offset. Maybe we can save the physical address of swapper_pg_dir in a variable, then load it from that variable instead of ttbr1. 3. Shared TLB machines ---------------------- Some machines may share TLB between CPUs, for example, SMT machines may share TLB between the two hardware threads in one core. The per cpu page table just can't work with it. Maybe we need a new cpufeature to indicate whether per cpu page table is allowed or not. Then just enable it for not-shared-TLB machines. 4. Don't support all VA bits ---------------------------- We just support 48 bits VA (4K and 64K) and 47 bits VA (16K) for now. For 4K and 64K, supporting other VA bits is not hard, we just need to determine the size for percpu and local percpu area. But it is harder for supporting 48 bits VA + 16K page size. We just have two top level kernel page table entries with this configuration, but we assume we just need to sync up kernel page table at the top level for now. We need to sync up kernel page table at the second level in order to support it. I'm not sure whether it is worth it or not. Benchmark ========= The benchmarks are done on 160 core AmpereOne machine. The baseline is v7.2-rc1 kernel. 1. Reduction of kernel text size -------------------------------- The patchset can reduce at least 11 instructions for this_cpu_*() ops. Both preempt_disable() and preempt_enable() need 4 instructions to manipulate the preempt count, and preempt_enable() needs more instructions (compare + READ + compare) to determine whether reschedule is needed or not. Because this_cpu_*() ops are inlined and called in a lot of places so we can save a lot of instructions. The size of kernel text is reduced by ~184KB with default Fedora kernel config. This also helps reduce kernel icache miss rate and stalled frontend cycles as kernel build benchmark result showed. 2. Kernel Build --------------- Run kernel build (make -j160) with the default Fedora kernel config in a memcg. 13% - 18% sys time improvment 3% - 7% wall time improvement 5% fewer kernel icache miss, 5% fewer executed kernel instructions and 15% fewer stalled frontend cycles for kernel. 3. stress-ng vm ops ------------------- stress-ng --vm 160 --vm-bytes 128M --vm-ops 100000000 8.5% improvement 4. stress-ng vm ops + fork -------------------------- stress-ng --mmapfork 160 --mmapfork-bytes 128M --mmapfork-ops 500 15% improvement 5. Specjbb ---------- The specjbb test latency curves showed the patched kernel has consistently lower p99 latency (the lower the better) than the baseline. 2.5% improvement on max-jOPS and 4% - 5% improvement on critical-jOPS. The specjbb benchmark is quite sensitive to latency and responsiveness, particularly critical-jOPS result. The patches are supposed to improve the responsiveness due to the reduction of preempt-disabled critical sections. 6. MySQL -------- 1% - 2% gains on read-only test, 2% - 4% gains on write-only test. Also see 15% decrease on frontend cache stall. Regression test =============== 1. memcg creation ----------------- Create 10K memcgs. Each memcg creation needs to allocate multiple percpu variables, for example, percpu refcnt, rstat and objcg percpu refcnt. Consumed 2112K more virtual memory for percpu “local mapping” and a few more mega bytes consumed by per cpu page tables. No noticeable regression was found for elapsed time. 2. fork test ------------ stress-ng --fork 160 --fork-ops 10000000 fork() needs to allocate multiple percpu variables, for example, rss counters and mm_cid_cpu. Roughly 1% regression was found. However stress-ng fork test has quites small address space, the real life workloads typically have much larger address space and do more complicated works. The stress-ng mmapfork benchmark saw 15% improvement. The organization of patches =========================== The refactor and prepatory patches (patch 1 - patch 4) Percpu page table support patches (patch 5 - patch 8) Local percpu area support patches (patch 7 - patch 15) Use local percpu area for this_cpu ops (patch 16) Yang Shi (16): drivers: arch_numa: move percpu set up code to arch arm64: kconfig: make percpu related configs not depend on NUMA mm: pgalloc: introduce {pud|pmd}_populate_sync() vmalloc: pass in pgd pointer for vmap{__vunmap}_range_noflush() arm64: mm: enable percpu kernel page table arm64: mm: defined {pud|pmd}_populate_sync() arm64: mm: sync percpu page table for memory hotplug/unplug arm64: kasan: sync up kasan shadow area page table arm64: mm: define percpu virtual space area mm: percpu: prepare to use dedicated percpu area arm64: mm: map local percpu first chunk mm: percpu: set up first chunk and reserve chunk arm64: mm: introduce __per_cpu_local_off mm: percpu: allocate and free local percpu vm area arm64: kconfig: select HAVE_LOCAL_PER_CPU_MAP arm64: percpu: use local percpu for this_cpu_*() APIs arch/arm64/Kconfig | 12 +++++++--- arch/arm64/include/asm/mmu.h | 5 ++++ arch/arm64/include/asm/mmu_context.h | 9 +++++++- arch/arm64/include/asm/percpu.h | 37 ++++++++++++++++++++++++++++- arch/arm64/include/asm/pgalloc.h | 24 +++++++++++++++++++ arch/arm64/include/asm/pgtable.h | 37 ++++++++++++++++++++++++++--- arch/arm64/kernel/setup.c | 3 +++ arch/arm64/kernel/smp.c | 44 +++++++++++++++++++++++++++++++++++ arch/arm64/mm/kasan_init.c | 47 +++++++++++++++++++++++-------------- arch/arm64/mm/mmu.c | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------- arch/arm64/mm/ptdump.c | 4 ++++ arch/riscv/kernel/smp.c | 51 ++++++++++++++++++++++++++++++++++++++++ drivers/base/arch_numa.c | 51 +--------------------------------------- include/linux/mm.h | 11 +++++++++ include/linux/percpu.h | 4 +++- include/linux/pgalloc.h | 13 +++++++++++ include/linux/vmalloc.h | 3 +++ mm/Kconfig | 9 ++++++++ mm/internal.h | 5 +++- mm/kmsan/hooks.c | 14 +++++------ mm/percpu-internal.h | 14 +++++++++++ mm/percpu-vm.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mm/percpu.c | 58 +++++++++++++++++++++++++++++++++++++--------- mm/sparse-vmemmap.c | 4 ++-- mm/vmalloc.c | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------- 25 files changed, 712 insertions(+), 144 deletions(-) Thanks, Yang