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 A307E606A322 for ; Fri, 4 Dec 2026 23:00:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Jzcj/A0W Received: by kanga.kvack.org (Postfix) id 8F9516B05B4; Fri, 4 Dec 2026 18:00:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8AA636B05B6; Fri, 4 Dec 2026 18:00:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7991B6B05B7; Fri, 4 Dec 2026 18:00:25 -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 570886B05B4 for ; Fri, 4 Dec 2026 18:00:25 -0500 (EST) Received: from smtpin26.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D203880631 for ; Fri, 4 Dec 2026 23:00:24 +0000 (UTC) X-FDA: 85507821168.26.E2DCBF1 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf04.hostedemail.com (Postfix) with ESMTP id 1EBAC40006 for ; Fri, 4 Dec 2026 23:00:22 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b="Jzcj/A0W"; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf04.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796425223; b=ByCfzuyn1EAfPsUStsRQY/mH1Hyis4/9O8eMFhG/Tnkp+WmRlQYrKwlDd54XE+EiiLOa0D /lh4os6hEX5EbxuEICluxqh6+uP3gwFDLBMDd51fIPk+5arNDxs2WOdgxShazPaeYyEEtz 3EjATN9vV8ZqnDoSq1BkaL7t3WXXtk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796425223; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qAFzYz+206QW+o6t0n9PdgvJR/tKePW+G1TPWUpgbd4=; b=wSV0duSd2amxlblbRdI6ow7QAWxAw0G7cy6MPv/r02Q82WID6UQ50/ivxF607DtQBv6mMS 2Xiulg0Ws2LshsXEZH0HVgwm2ggUUhoTVep8OHTxaUTpHAPRmoitXecPClKi4LkOpMSU3+ S+j91YX7cJvX/mNB2I8OXrdo9Idltp4= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b="Jzcj/A0W"; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf04.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 4BB0844F8A; Fri, 4 Dec 2026 23:00:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DD701F0093B; Fri, 4 Dec 2026 23:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796425222; bh=qAFzYz+206QW+o6t0n9PdgvJR/tKePW+G1TPWUpgbd4=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Jzcj/A0WxJnDrZ/TR0cUM69bltArrIt2lIQDoLzKmK0nCLq0vfc9/AXoJWgznD1VD V4dKys+B3iCgYTNFzE1dT1wJJi1EtVdnxBY+g3NwC4be9LSu03Cb8q4yT51hfbJwUD 0C/AsnbglHOTD8sqammVRM4mU1PAYTjppGVi+zGZAJEvrMZsn5pzO+oVUQszfk3Q5r CGscSaNn8OojrovkrCTL11pboS4HlM/3fl0tj0O0DrVIdVmFpe35Vfns04db+Y2xpP rqP8jqBmGYTqsseVwYbJq3johfMy8Aq5xLnYPE2yWAekA0rbFNZl1uVDngGQrcUmvU 0WEt9b/eDRXhw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 2/2] percpu_ref: defer the release function when the last put is in NMI Reply-To: sashiko-reviews@lists.linux.dev To: "Shakeel Butt" , "Dennis Zhou" , "Tejun Heo" , "Christoph Lameter" Cc: "Andrew Morton" , "Johannes Weiner" , "Michal Hocko" , "Roman Gushchin" , "Muchun Song" , "Alexei Starovoitov" , "David Vernet" , "Vlastimil Babka" , linux-mm@kvack.org, bpf@vger.kernel.org, "Meta kernel team" , mkoutny@suse.com In-Reply-To: <20261204224016.325944-3-shakeel.butt@linux.dev> References: <20261204224016.325944-1-shakeel.butt@linux.dev> <20261204224016.325944-3-shakeel.butt@linux.dev> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 23:00:20 +0000 X-Stat-Signature: co6g4c3es6fxzqratrzqfjnixqecg3zs X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 1EBAC40006 X-HE-Tag: 1796425222-727854 X-HE-Meta: U2FsdGVkX18+0f5M6CTW7amITUat+2F2s3/tbxUHXwkIYHOGYTxtn9B4yoS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nj4OVCJqEUQSuaDQiLWkcCGR43g8lAKqbiPwQmapbnw+Qg28M9OXPhiOdHTM6z6VuA04oA3ak3wox6BKZCcCVXXMCQXxEK9durdYJKpO/LCCqGBW89Fr17fVSvB+B409EVlAzrxmh6OO2jpAOECkZxaXVJvD5pjoQLHAMjriudG1+qSoYa5E+m8eqsI3udnh6jGHHGf8E4t2NmSxR2npBUeBIAR6WLt7dHD36phwtV1YPKy0wvE17P6IrSoKEbnVizEKgUyJjZMWmy7eZzLRfD0GK3hnzLhOY5IrowwbwjKAwMXCYirAz9/kU4o1aT6nh6SHFectQWpFwRXdpZV/STYVCaX16cnaZpdJNhxl7+pCA4YMLVF7SI6wSk6t5YmAICG7KJplfjOh+GUUAUZtvejXGA8Wv1CrdcPLBgPRw3lQf8Zqkxh0PtVPFTbUq2afw/0IwQNnxQRFPQcM4zzx1oEafmEVUZtYMSs2+R3WDTdAYck0RbvE3bxD66T5B7QXaU0OuEcnYKVXiViGOb7VqH3QZ1L0F0ZmtWrEb3Z42uGiQmRCUacbalyGU2sI1u28Q8baOdv4Y2EnNYKPnOg89277FitpcvP2Lylhj/8l1TSdQTwKUJnLx/calBC43DaLWMx+J71PmxVgjQKj/FtIXEeGwV1QG5U07hdaQ4orczS186D1wTVDNvTNBNeP4TNQ4ob3MH4Jvw== 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: - [Low] percpu_ref: percpu_ref_resurrect() doc misstates deferred NMI release rule -- commit b7ced7ae84eee24dc735178694ab43386fd34329 Author: Shakeel Butt percpu_ref: defer the release function when the last put is in NMI When a percpu_ref count drops to zero in NMI context, this commit queues the ref on a per-CPU llist and defers invoking its release callback to irq_work, reusing the rcu_head storage in struct percpu_ref_data for the list node. > diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c > index 5def04e3a2c34..b12cc1568d293 100644 > --- a/lib/percpu-refcount.c > +++ b/lib/percpu-refcount.c [ ... ] > @@ -498,7 +504,8 @@ EXPORT_SYMBOL_GPL(percpu_ref_reinit); > * > * If @ref->release() frees @ref then the caller is responsible for > * guaranteeing that @ref->release() does not get called while this > - * function is in progress. > + * function is in progress. That includes a release that > + * percpu_ref_put_many() deferred from NMI. > * > * Note that percpu_ref_tryget[_live]() are safe to perform on @ref while > * this function is in progress. [Severity: Low] Should the NMI deferred release requirement here be unconditional rather th= an tied to "If @ref->release() frees @ref"? Even when release() does not free @ref, resurrecting it before percpu_ref_nmi_release_fn() runs leaves data->nmi_release_node linked on the per-CPU percpu_ref_nmi_release.refs list while the ref is live again. A subsequent switch to atomic mode can then pass &ref->data->rcu to call_rcu_hurry(), overwriting the aliased union member and corrupting the per-CPU list. Stating unconditionally that callers capable of dropping the last reference in NMI must wait for the release function before calling percpu_ref_resurrect() would match percpu_ref_put_many() and percpu_ref_reinit(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204224016.3259= 44-1-shakeel.butt@linux.dev?part=3D2