From patchwork Tue Jun 13 18:24:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 107511 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp760348vqr; Tue, 13 Jun 2023 11:55:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5gZYnfCAoz/TLug00ffz4W5V1ynPtg90VKnQBvFvuGV16xOpwewliwHP1POCr1YP5njwR5 X-Received: by 2002:a17:902:cecf:b0:1b0:f31:a386 with SMTP id d15-20020a170902cecf00b001b00f31a386mr13623628plg.26.1686682521750; Tue, 13 Jun 2023 11:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686682521; cv=none; d=google.com; s=arc-20160816; b=ZNcSI9yl3xRhKhQOTOi2aapQZRni/uW5qHryM9RZih7NquETVIdHT5I4crdnpUABUE 5sOXI8HAkvf9zIwhnqhMt3F/c/NBLYSUlsu4rW4z6Ve/MFSlX7Crq5nkLAo8C9iK04WB nZl6bbolW64cANhR+X/O6fe1OUTs25Yt8zsBVagr/Wt9cqyGt4kGiNlPca+dp0i5vXaV 0CFwq5PAo+lQ5DQZxY6HAFcxVVzjj5v8eSR2vGy33LuPVwSqm5Xlo7QHVvLSlew+oUmE s8lCTN5hkp3+fHWkDMscV/CkFrbQyGN6RgFVBiz2zBN6ueSKCZ+SGqbuOmlMUOB7cCQ9 H0GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=M6PNj3WnDRjWWVcxdlTnpz9rdhAWLwVTgGBFcDSLfEs=; b=hgbaabCo7wqPJxcMZzSvOnBOQvcwSQNDXJSqz54TSe6efdkySum12G2vAfIAHYJWGd XmlKpbwMZjjUADSWtxQXWDhxG/BYXFRI2hm1JKbYizi4G97Mf1gdFFskCnY1//hdWT41 c+FdiDu8398bdj4b4Gl33HBoy+K8QhfBrjFxQrH7P8NW6TZ95cqOcPGRY0p8Uwxikb8F 6dYC22Um0zG0ExRz8UjWIsHPR46xcDExl6aWK/a6vGCjcyiBiQWQNxcu7DlCTBj1uyLu bF0wdICiAL+3oVvwdCm1HXsQdOedXkBrPQ4ey6bqKGJUQIOEiZ6D7cYhPNLmEeA/PsOF NSBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g8HivGph; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z8-20020a637e08000000b0054f9f9b333csi2864289pgc.686.2023.06.13.11.55.08; Tue, 13 Jun 2023 11:55:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g8HivGph; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239495AbjFMSYp (ORCPT + 99 others); Tue, 13 Jun 2023 14:24:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238881AbjFMSYl (ORCPT ); Tue, 13 Jun 2023 14:24:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B60421709; Tue, 13 Jun 2023 11:24:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CF1526340C; Tue, 13 Jun 2023 18:24:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0319C433F2; Tue, 13 Jun 2023 18:24:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686680679; bh=Edls777YKMqINxfhwzexWbmVYJbfX6Dotujbh1uSNaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g8HivGphNlKC/BBPzZXi/F+QEtdGXeSaIEMGlnYZPhGe9/MX/ReZv2APD1N5QxYSY quMgGsWg1BjNQi/KfpR1o0rSbkzzU7yR8bfYVC59aGPBDmgdKMfgmyhiQwv7vABsW0 8zReTYbeOO/RRLR7mUEbeFeZ2EGmtB6+KyaiiIVT+ZSQzCGQXKPkShwB6hv1FKClY9 vg0DGwD5FPmm4ttLlXiIcVo6FCxCkeMAIhytJi1qVlDMtpYueIf2AoByOdp9qJwyPo G+Y9mRMdxeEdhXWmB72Ex7DFQXJrIj8tLkus/j7fE9i4fXyb4uISDS/g+zMjilyIII OecBzWPuCyTIA== From: SeongJae Park To: paulmck@kernel.org Cc: SeongJae Park , joel@joelfernandes.org, mmpgouride@gmail.com, corbet@lwn.net, rcu@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] Docs/RCU/rculist_nulls: Fix trivial coding style Date: Tue, 13 Jun 2023 18:24:31 +0000 Message-Id: <20230613182434.88317-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230613182434.88317-1-sj@kernel.org> References: <20230613182434.88317-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768614812171762148?= X-GMAIL-MSGID: =?utf-8?q?1768614812171762148?= Lookup example of non-hlist_nulls management is missing a semicolon, and having inconsistent indentation (one line is using single space indentation while others are using two spaces indentation). Fix the trivial issues. Signed-off-by: SeongJae Park Reviewed-by: Joel Fernandes (Google) --- Documentation/RCU/rculist_nulls.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst index 9a734bf54b76..253ecd869fc2 100644 --- a/Documentation/RCU/rculist_nulls.rst +++ b/Documentation/RCU/rculist_nulls.rst @@ -26,7 +26,7 @@ algorithms: :: begin: - rcu_read_lock() + rcu_read_lock(); obj = lockless_lookup(key); if (obj) { if (!try_get_ref(obj)) // might fail for free objects @@ -68,8 +68,8 @@ And note the traditional hlist_for_each_entry_rcu() misses this smp_rmb():: pos && ({ prefetch(pos->next); 1; }) && ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); pos = rcu_dereference(pos->next)) - if (obj->key == key) - return obj; + if (obj->key == key) + return obj; return NULL; Quoting Corey Minyard:: From patchwork Tue Jun 13 18:24:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 107507 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp752876vqr; Tue, 13 Jun 2023 11:39:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ724FjQQz8mFLj+pxBITtFshki3AZjRYt11PJ1hOVyCmwT6uYV+aJmDg7WQN3jCy6NqMd23 X-Received: by 2002:a05:6a00:14c2:b0:658:12ca:385b with SMTP id w2-20020a056a0014c200b0065812ca385bmr15548121pfu.22.1686681546951; Tue, 13 Jun 2023 11:39:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686681546; cv=none; d=google.com; s=arc-20160816; b=XRf8OiqdtXWYFyCwivtMdurEL5aQo5z0eChG3KPI6amXhveYkdbwb2dw7wJrUgmHZ4 CRl74en0DkdFRC+ZctJmV0YyDtu4JCQzKL7tf09wpFEZEx811PIFkJE5f2l8/R5r8SMx gnOJLmKt+HcUWj4J771jM4rcODY7PZXqr8lkpjP19AfLjxdJaQ5h9g2ISSBuDWbo7NyO VKm7w3UJfUu8te4zhDln6rwffRTRZ5ovkmmE56lVBX8c65uMoW7qX8IRyIjVh0aGJvz6 nP79KkMDQTpL77OyMFwmPnq4oG67U+1BBPZInVzn+UbqZGNaTHWCHc/hWwPIqxbAy7tm LkzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=V2+P0FxQ8sw5Qzc3xYODPHVgQfNkPFiKHBj/m94GwH8=; b=HA2tWBYfACyMv47euIdgVgsFcy3upf86P5/C35XBnvxWkMTWkj+S2PqJA7Ns4kiIlH H7p9GXaUJSggt6fqEIfQov2AfWO/yWJsFo+bmWWCMJXPwWND3BIWaCT9Iy6wrYlbM+gP ruB5Kak95HmxgigHN0ginggB8t154+dOiHjeiT38uc31601nHpB9IUZ2WExi6hyUk4vy kBCGDAowVyyl2wUdkFBnhl1M3Jt9fDZ68kxCZV4j7y9WUVl65iTQkIW4jyj0dHKQYyFJ zyMD9lDQm0tMvROLYPLCDnj+EUl8h2XLim5+xOPDDHrc1J9qvS3SrzWGMzP0XQm3+cKw tpXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NLe1oDvv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c27-20020a056a00009b00b0063b8ab7f91csi9125872pfj.365.2023.06.13.11.38.55; Tue, 13 Jun 2023 11:39:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NLe1oDvv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239718AbjFMSYu (ORCPT + 99 others); Tue, 13 Jun 2023 14:24:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239242AbjFMSYm (ORCPT ); Tue, 13 Jun 2023 14:24:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F30E41; Tue, 13 Jun 2023 11:24:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9D23C62F59; Tue, 13 Jun 2023 18:24:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78518C43331; Tue, 13 Jun 2023 18:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686680680; bh=8QtwSYO8fDJCyX3Iukfsqd/4jzpKwmY5DKHH76v+mD8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NLe1oDvvlDNZZOS+fcGdvyQGzbtGAu6o52EhnNihiyzLUr40EX0ESaFKJ+C8VUGm7 3B2ao510PdqLceIpEBAQHFLcjZDj+ibxFG7xGS2v0dddzUw3h9BDOlOh2aekouM0Nu 8nsaioUIkdfb8YTTx0QtWEsnKUwW++YXrqthph+T0P/yjJ2eynVkbejNRgItTykowt zbA5omcQSINpvyzkw4GpVzcHGp7DyKDrdU0DHhG+EsP9vghbx5JdekUGLUkIMmTQxY CzLuNzhTNlmKdzbqMJA2pAABmPikZJ6HKDqArYJF1d8BIAl7ySLIT4H3rHAUxInWDp 9J5JMtL7eFIzQ== From: SeongJae Park To: paulmck@kernel.org Cc: SeongJae Park , joel@joelfernandes.org, mmpgouride@gmail.com, corbet@lwn.net, rcu@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] Docs/RCU/rculist_nulls: Assign 'obj' before use from the examples Date: Tue, 13 Jun 2023 18:24:32 +0000 Message-Id: <20230613182434.88317-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230613182434.88317-1-sj@kernel.org> References: <20230613182434.88317-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768613789785246269?= X-GMAIL-MSGID: =?utf-8?q?1768613789785246269?= Lookup example code snippets in rculist_nulls.rst are using 'obj' without assignment. Fix the code to assign it properly. Signed-off-by: SeongJae Park Reviewed-by: Joel Fernandes (Google) --- Documentation/RCU/rculist_nulls.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst index 253ecd869fc2..94a8bfe9f560 100644 --- a/Documentation/RCU/rculist_nulls.rst +++ b/Documentation/RCU/rculist_nulls.rst @@ -54,7 +54,7 @@ but a version with an additional memory barrier (smp_rmb()) struct hlist_node *node, *next; for (pos = rcu_dereference((head)->first); pos && ({ next = pos->next; smp_rmb(); prefetch(next); 1; }) && - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); + ({ obj = hlist_entry(pos, typeof(*obj), member); 1; }); pos = rcu_dereference(next)) if (obj->key == key) return obj; @@ -66,7 +66,7 @@ And note the traditional hlist_for_each_entry_rcu() misses this smp_rmb():: struct hlist_node *node; for (pos = rcu_dereference((head)->first); pos && ({ prefetch(pos->next); 1; }) && - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); + ({ obj = hlist_entry(pos, typeof(*obj), member); 1; }); pos = rcu_dereference(pos->next)) if (obj->key == key) return obj; From patchwork Tue Jun 13 18:24:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 107514 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp767731vqr; Tue, 13 Jun 2023 12:08:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6O5I5CJSfzdoAnq2HwmhrWY7OE4Hu2vz9jEtIGdr653OPyZQlNEikb6vHqJyt+728kYboh X-Received: by 2002:a17:906:da82:b0:979:7624:1f71 with SMTP id xh2-20020a170906da8200b0097976241f71mr12117357ejb.26.1686683310845; Tue, 13 Jun 2023 12:08:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686683310; cv=none; d=google.com; s=arc-20160816; b=NZgr9xqyAwYljJ3hQqRW9YMDIqVboeNQ0SBTND32aSC2ImhEXjEW4d4M32+foZTcsK 7XmkSEbtFYmEuwb2BNqMea+u2Or7TnqR8UJDmrMXC4rrkjs8Y4D/5xuoW4jwKkTitGJv NlR9u8IF0Ojqmvj+jdKZVgBGNIl6+EZUkD5lQwvuORVGo+cDfygOP3zZgERg/cL3+rDw LoXWOt5k7RPglpnViqt5/Fl+yVaRFULPUqpeE9OOo51HtsJQOKzY/Au/GJGV8DdFPlEW dNhM/kYSiqOBXavJVCsR9Wgs+d1f9BKh9ZrLKLJtNfSg2ZT/U3nwHwWjxraYUkKCTijx BU3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ulfwIl/z03ZpRLXacLDn8cP9Nlwi1O95dPCEm3jGDuQ=; b=smmE6l1/hSboXQ+rce/IOcpN6Wg2fxdq6XaGy5eV8KbciydEGVlcNs5xtYmzA7Ri1I uQhh8SAxWYpTV5y08v+luD1pKE8iNC3+rIut4L1CZQzMxFBxA+ltMkqcCqwhFaOisd4d d0ssJxfOStaAClt3B3ZsrPrM1QBl0to5oA2/Ui5+Ghs4JL4OkzBNvc3KYVt6QLU50VLA qJXwRaoZT7ElkaHnA8lpzpAkP2U5wJZv6yrj2q2+uVINIZCuYhvS6nzYEQy8g168rV7m SigHf1I17s9n0HMckRDAaEXRIOi2C6Rmdbl9aJsrbj5HPUMM+efl8+AcVrBLt6uZaBsN XkXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MqD8aL5x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gx21-20020a170906f1d500b0096f8928ed7fsi7244436ejb.254.2023.06.13.12.08.05; Tue, 13 Jun 2023 12:08:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MqD8aL5x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240540AbjFMSZX (ORCPT + 99 others); Tue, 13 Jun 2023 14:25:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239464AbjFMSYo (ORCPT ); Tue, 13 Jun 2023 14:24:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09A761709; Tue, 13 Jun 2023 11:24:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6530E62F60; Tue, 13 Jun 2023 18:24:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C47EC433D9; Tue, 13 Jun 2023 18:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686680680; bh=WK1M1XZ0REtusB+Bs/9PHEmAd7saEbfCwi8rA6lQtaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MqD8aL5xO0CWMpkkeYW/yEn/4+ZWMtrDpJOPYc0AU818+2mltncssD4pRjLE2v/YE ul1fEqAlvphMYolgDGG9dNXMwTwv+yb6uyT1Jpv7xjDUnrbI3hMNu7NGhviBtdiQl8 eiWkvTmmoNciGcnP3TqkTDEujMewqkeFRiVq+yVsPLkHT7DCokzG9BA8GNHMjIwNH0 SE93O2hrvohcQJ499bLwlKsUGX6e/bFGvSJqT8kXNWjMJNS6rFJrrraKh+Z9noaoPD P4+JcxyVTpuuiTC4hdmAoXL9K4eJOSQt17S27ncIO6i6z1VPi/hIsT8QPEtN5H5o5c aqWzq9WFhO91g== From: SeongJae Park To: paulmck@kernel.org Cc: SeongJae Park , joel@joelfernandes.org, mmpgouride@gmail.com, corbet@lwn.net, rcu@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] Docs/RCU/rculist_nulls: Fix hlist_head field name of 'obj' Date: Tue, 13 Jun 2023 18:24:33 +0000 Message-Id: <20230613182434.88317-4-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230613182434.88317-1-sj@kernel.org> References: <20230613182434.88317-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768615639606068770?= X-GMAIL-MSGID: =?utf-8?q?1768615639606068770?= The example code snippets on rculist_nulls.rst are assuming 'obj' to have the 'hlist_head' field named 'obj_node', but a sentence is wrongly mentioning 'obj->obj_node.next' as 'obj->obj_next'. Fix it. Signed-off-by: SeongJae Park Reviewed-by: Joel Fernandes (Google) --- Documentation/RCU/rculist_nulls.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst index 94a8bfe9f560..5cd6f3f8810f 100644 --- a/Documentation/RCU/rculist_nulls.rst +++ b/Documentation/RCU/rculist_nulls.rst @@ -86,7 +86,7 @@ Quoting Corey Minyard:: 2) Insertion algorithm ---------------------- -We need to make sure a reader cannot read the new 'obj->obj_next' value +We need to make sure a reader cannot read the new 'obj->obj_node.next' value and previous value of 'obj->key'. Otherwise, an item could be deleted from a chain, and inserted into another chain. If new chain was empty before the move, 'next' pointer is NULL, and lockless reader can not From patchwork Tue Jun 13 18:24:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 107505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp746891vqr; Tue, 13 Jun 2023 11:27:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6mIyA6XsszWoDo/R4o16TRh6WHBskzFpJDcnWbJjj+VNqnfvuoumBnHj0LVinlJJiU3JqX X-Received: by 2002:a17:906:58c5:b0:974:5e8b:fc28 with SMTP id e5-20020a17090658c500b009745e8bfc28mr13875469ejs.9.1686680861603; Tue, 13 Jun 2023 11:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686680861; cv=none; d=google.com; s=arc-20160816; b=jvO2Fp/EKQmeuBmdwJ3+35tFnGQETmQ+c7szJt4ypchNBIW1KMEoiSKqinANY8x78V t+d1Ipyajw59bqouuAACbNyi2mhzC7fWZlZF5WxOecBsV1cPMNCj7B/teC+FchD3EbOR NdHLoVJeosP9/Ho5uJxDqzzvY65IqNTuJMtUTjrvHSvfuZuRsS0y4+LDn+iXuv6XQiG/ Rr2eyn8mhqQNLT93AYpBzk5RxZCY8g8jLt1t5UBXgVenKXvH7r5EFFyHfCgvXAN1YJsB Oig+4iA6zEezAI3hVubNF77nJ+/L9yjExWZwvdywda6sFoq7B0oPubWnjz+fgmVppBqI biQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5Awvwvnf2Yio6gduOGwuv1jP6KBOIsfXhpavq3jscoI=; b=u/02ilcZIFHMelzp7DlhI/YwLTg2ZIgxvrQbmIquH99CTRVvXpACCD1u6DwntmFDBj 9CpZRrzYhy+AM9Mr8rkxQvulwTdY7cu2ZyJ81WPo5zlL4h5Ghp8yAWpITaBlWyBAt4Mc o6nU/FwoLPz5ssOMnqi4U5zDg4aRkw3YlrdDatF6jIV+9ZaMA2AZgUZXwFvi1+eFfkcl gw/wjeh0TF3nN8Do8/ia2iRzhxhuZCKs9BeUrwFeCCgSAGFeVzXRUXA7UB//IAOZgQXY lOpE/293OAbEXMLpDDqXKGCBdLLTQuMLioAkM12IefDY8JcWymj4OtGh9E4+ZO2C6Mdj TTAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BhJ2cluN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p22-20020a170906499600b00977cb7af75asi6721919eju.719.2023.06.13.11.27.16; Tue, 13 Jun 2023 11:27:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BhJ2cluN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240430AbjFMSZT (ORCPT + 99 others); Tue, 13 Jun 2023 14:25:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239370AbjFMSYn (ORCPT ); Tue, 13 Jun 2023 14:24:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A54DE41; Tue, 13 Jun 2023 11:24:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2F36063365; Tue, 13 Jun 2023 18:24:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 125D1C433F1; Tue, 13 Jun 2023 18:24:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686680681; bh=tKaE0feCA4Misffydrf5UR6uG+RXTeYv2hshyi6erLw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BhJ2cluNI4psNgHorBPau3CpVT1R9LA6maOtkq4Jg7r+eOP1b9SBvIOw2gL4U1U+p sJTDHRyT0xThUGQQ3SLFPV51kBaQry3fG6EpHHmfpVx6TLUEBMwzHlrlcuav0vhQaV BtJbiA9mYF3TaUyVgC1XDtp32cQR+GRJ5jE5SXiqkHGYF9M9LCMyC1VBaVAdeE8YB6 rbd54j5/RMZflfPPq/WfFhiV2g7HBVbkOaX4veNpewafKHPPILbiiNeVGRg4OX1rSp 24wcRcOPE9R4POUba/uQafK1PW/ggSSCEq1vPrrhTKW4g84QbMBGLbMau12YYQpZpk ouVO+GoDJhOzg== From: SeongJae Park To: paulmck@kernel.org Cc: SeongJae Park , joel@joelfernandes.org, mmpgouride@gmail.com, corbet@lwn.net, rcu@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] Docs/RCU/rculist_nulls: Fix wrong text about atomic_set_release() Date: Tue, 13 Jun 2023 18:24:34 +0000 Message-Id: <20230613182434.88317-5-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230613182434.88317-1-sj@kernel.org> References: <20230613182434.88317-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768613071024068310?= X-GMAIL-MSGID: =?utf-8?q?1768613071024068310?= The document says we can avoid extra _release() in insert function when hlist_nulls is used, but that's not true[1]. Drop it. [1] https://lore.kernel.org/rcu/46440869-644a-4982-b790-b71b43976c66@paulmck-laptop/ Signed-off-by: SeongJae Park --- Documentation/RCU/rculist_nulls.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst index 5cd6f3f8810f..018cc100d19b 100644 --- a/Documentation/RCU/rculist_nulls.rst +++ b/Documentation/RCU/rculist_nulls.rst @@ -129,8 +129,7 @@ very very fast (before the end of RCU grace period) Avoiding extra smp_rmb() ======================== -With hlist_nulls we can avoid extra smp_rmb() in lockless_lookup() -and extra _release() in insert function. +With hlist_nulls we can avoid extra smp_rmb() in lockless_lookup(). For example, if we choose to store the slot number as the 'nulls' end-of-list marker for each slot of the hash table, we can detect @@ -182,6 +181,9 @@ scan the list again without harm. 2) Insert algorithm ------------------- +Same to the above one, but uses hlist_nulls_add_head_rcu() instead of +hlist_add_head_rcu(). + :: /*