From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C70B606A322 for ; Fri, 4 Dec 2026 09:22:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nyQvFkJc Received: by kanga.kvack.org (Postfix) id 0C4866B05B4; Fri, 4 Dec 2026 04:22:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0755A6B05B5; Fri, 4 Dec 2026 04:22:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF6E86B05B6; Fri, 4 Dec 2026 04:22:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C4EC66B05B4 for ; Fri, 4 Dec 2026 04:22:28 -0500 (EST) Received: from smtpin29.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 57606802D2 for ; Fri, 4 Dec 2026 09:22:28 +0000 (UTC) X-FDA: 85505759976.29.F9D8E43 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf05.hostedemail.com (Postfix) with ESMTP id 9DF40100004 for ; Fri, 4 Dec 2026 09:22:26 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=nyQvFkJc; spf=pass (imf05.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796376146; b=QcREJSDltTQN2TygnEFsLHk9VypLi7G3gsINSBkR487LpAi6tjJ2dlZxZDRRmDqHpsiTWz eMV88IQg7zyIt05/J3MsD5POjifbylYGqMghZVI9mkFJXrvJeD3bEB46Q4FFLsdUFuhbx+ 7CT5JcfNNOctnrqGD2OJZJMluPnl+FQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796376146; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5daM9B6xPZP3sekMjDE09Gb5KMExQydX4NHrbTk5jxM=; b=jC4zDPm6dqhMrfPJzuCJ4vWMYIEB++Szan8IO86xsfyWr5cVUGujWLFAmFxsJMObiaJuSQ iiMSHnxh01LIifSVtPr9icloaXWs3xOroYBPD+fqrHKY1C7UXKbMyRiZkAb1jLcuZIaC2X +4Vaiv2MErtjuBj3GazMKnJgTvbLXbk= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=nyQvFkJc; spf=pass (imf05.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id AFB4440349; Fri, 4 Dec 2026 09:22:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 519C71F000C2; Fri, 4 Dec 2026 09:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796376145; bh=5daM9B6xPZP3sekMjDE09Gb5KMExQydX4NHrbTk5jxM=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=nyQvFkJc/deDh5sHd9mNPlLb2T2oi/9L3k5IqXrCR5rKkrQ/UAEsG/t3dpp5DZlar IY/FiPsvQ4ytZQXqbDXevRem3agb9m+w5JXpyOl0EzHdbWwOflEoGFwgN4UNQ2mqN6 EB2/vrE5GqNPVznipFJKNbeO0vj8IvSzMEZXRUy0QzfW29Amlmd5PRrg7N0RWbicm4 CK6KirA2mML2dtyew6H9tS2ZDKSheJXFBRegEHGnfYpRx131xBhenarREAmhM3aeHM +XcuVKTGvxHt2ySwu3ifN20A7f2hyte+fFjgJjqQ2YkQZTfu8obYcDnKpX/B7IBPQr 6ieWQO5AcdCFw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v12 02/10] riscv: add infrastructure for preemptible this_cpu operations Reply-To: sashiko-reviews@lists.linux.dev To: "Yunhui Cui" , pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, dennis@kernel.org, tj@kernel.org, cl@gentwo.org, oleg@redhat.com, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, ihor.solodrai@linux.dev, bjorn@kernel.org, pulehui@huawei.com, puranjay@kernel.org, broonie@kernel.org, dave@stgolabs.net, david.laight.linux@gmail.com, jszhang@kernel.org, tglx@kernel.org, conor.dooley@microchip.com, thuth@redhat.com, ajones@ventanamicro.com, ben.dooks@codethink.co.uk, rkrcmar@ventanamicro.com, samuel.holland@sifive.com, zong.li@sifive.com, debug@rivosinc.com, seanwascoding@gmail.com, andybnac@gmail.com, menglong8.dong@gmail.com, cyrilbur@tenstorrent.com, wangruikang@iscas.ac.cn, atishp@rivosinc.com, apatel@ventanamicro.com, arnd@arndb.de, nathan@kernel.org, nick.desaulniers+lkml@gma il.com, morbo@google.com, justinstitt@google.com, qingfang.deng@siflower.com.cn, linux-mm@kvack.org, bpf@vger.kernel.org In-Reply-To: <20261204085859.42277-3-cuiyunhui@bytedance.com> References: <20261204085859.42277-1-cuiyunhui@bytedance.com> <20261204085859.42277-3-cuiyunhui@bytedance.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 09:22:21 +0000 X-Stat-Signature: xhz56ao7ziyytoooih5rtsujy9q75q3p X-Rspam-User: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Rspamd-Queue-Id: 9DF40100004 X-Rspamd-Server: rspam01 X-HE-Tag: 1796376146-399247 X-HE-Meta: U2FsdGVkX19qPnJMORjf/bc6YVgx9OpP6JdAeNG5WjKqYsxJWyB1D71HNxpsOsZLSm50jny5+NmVn0Ah//SbXo+eflwzAyHVVxikM8F/wW4EHyT2yaCZdOvltvoVeRsxTFEczgnpLyKVZ7r958EdPxkLjGP4OVOnu6OJp2w4k+5+n+73DS/mT64IcVHccNVp7YDp5wzKLH8os42FHEPIZtlYsJgOyVQp9LriljscP729ncZoy8M59vZGy8QIkFqjkkw1HamQvY7YsYWmT4AFh5lRQFWTE5Cjt90j33kSpSRhcx6hAtNSxh96nEqxF/PbhiY3RiCXXXich45o4OgUWcDnzQmCRznPHZrn9iKSgawzgSpUBmZ8wJEhY5qveGLXl5wmQH5JHitpZrhUJeHfZenhmmmtv+qbOBaGX1om4b/znrYotxPaM7WHSaAUNgQrGGRRsAZOSxItEFJI52zFrXEVUnvh8tXo21qucxMih4An+SnW1mPgQFaoU2RX1kgRILJ3hDOfS9Lq+e9HML1hfqyxw8Tria0ZU525hRrYIOaWlZwvuw2YARaIR83BgGm+GqBMgxEcqtJqDPkiGfn9vV4CXvG38YoISKsAKLvGKLc0vn2fXOPFlRtE/0SDhPzbIIUVnLA8MBPK/6NhxnBFWyFzoipMmBdp5/Bo/aqhh0nlUs88VyFXqI9uj39MFdRHvu1WpsLLPTTOKidx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AUvxGiSfQ9972UE35451CViqH4miTuZcw6gi05TEz+paJi7CBVYbxByHNscOpDKSm2kPJ7nnG77q6g3xlbRxy02CcJx8QlE/sLWE7lcZi0f5sVagI4+ejVfq57XdTTPZlcY8SaNWcMwQ8kTeq4651q4YmY4wadYUmy7xxvrF rZP16zX5 VmZrIl9RjGkm243WkonAmQ== Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] riscv: thread_info.pcpu_gprs sits in second cacheline causing false sharing -- commit 0d0238bba2276b5a96d3ce6a47b34f916b2e4701 Author: Yunhui Cui riscv: add infrastructure for preemptible this_cpu operations This commit adds per-task tracking of per-CPU address-generation registers = in struct thread_info and struct pt_regs, along with exception entry and exit handling to fix up those registers after CPU migration so RISC-V this_cpu operations can remain preemptible. Link: https://lore.kernel.org/r/20261108213254.67805ef0@pumpkin Link: https://lore.kernel.org/r/avG07pmpcLGkq5i-@xhacker [ ... ] > diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/as= m/thread_info.h > index 523e95c1eedb8..4a123d40fbf4d 100644 > --- a/arch/riscv/include/asm/thread_info.h > +++ b/arch/riscv/include/asm/thread_info.h > @@ -79,6 +79,9 @@ struct thread_info { > #ifdef CONFIG_RISCV_USER_CFI > struct cfi_state user_cfi_state; > #endif > +#ifdef CONFIG_SMP > + unsigned short pcpu_gprs; > +#endif > }; [Severity: Medium] Does placing pcpu_gprs at the end of struct thread_info put it in the second cacheline and cause false sharing with struct task_struct? On 64-bit SMP kernels, task_struct embeds thread_info at offset 0 (64-byte aligned) with pcpu_offset at offset 40. Appending pcpu_gprs puts it in the second cacheline (offset 72 on defconfig), sharing it with remote-accessed task_struct fields like __state, usage, on_cpu, on_rq, and wake_entry. pcpu_gprs_entry unconditionally stores zero to pcpu_gprs on every trap in handle_exception() even when already zero, and each this_cpu operation writ= es pcpu_gprs twice while reading pcpu_offset from the first cacheline. This dirties two cachelines and bounces owner->on_cpu in mutex_spin_on_owner(). Placing pcpu_gprs in the first cacheline alongside pcpu_offset (ahead of colder fields like scs_base) and skipping the zero store in pcpu_gprs_entry when the loaded value is already zero would keep hot entry and per-CPU state in one cacheline and avoid false sharing with task_struct. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204085859.4227= 7-1-cuiyunhui@bytedance.com?part=3D2