From patchwork Thu May 18 22:40:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 96087 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp857224vqo; Thu, 18 May 2023 16:10:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5FVaT0dpyQvxkuT8OdkvO0K/Jqa+KiFiNt8MlkU4qutN4ZHFfTrpG1nGb0q72UXR3Rck6A X-Received: by 2002:a05:6a00:10c1:b0:638:edbc:74ca with SMTP id d1-20020a056a0010c100b00638edbc74camr721453pfu.0.1684451403883; Thu, 18 May 2023 16:10:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684451403; cv=none; d=google.com; s=arc-20160816; b=EIQ/0QuVdqdZlfwRlopTXuDghVPIzd4YYgc53B5R+F1zOHLdP7CjXKJN5ijXCwjlw5 h+0t6Em2qyvMkUT8V5Ml6SEJvkLyY3WBFRKxkvA+crVatHJtxyoA5xpxie/LFHZ5jXum h8W8dtnMs5hPLVHSDu3J2qUDSHsVvCetdH72J3HhTPJdBFe6ZejX5UelVCHLtDeeX16u se1FbcWhUROIL9zTLTv4jG0Jj/SKqfGvpdB+LRKjZ5XKBYGGoRHJd+nGZn/bS6UYwNeB YBKtBZzwQ0HnMdVNFwkij/3RLFmoiEwNz0iLKFWdee/Ze2ZKHEt1Ii4q0e7bAnKln/WH MRNA== 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=xRw4WF1wiSgqFSpljTD2dXfSo49fRCLvxVwf4/bdXCo=; b=H+2+I/uxDLV4V0VVInBV05xuX4BUuRdM4vuUh7T9p1qiCPGsigriIhznBObTajlL9R ODYzv1uNw30IVS8F6JeC/DkR+u/QvbUUckFSyavHyrCp1mf43KawivIjNy/K31g+SLHJ 050vEFe+rB1OfOOhpy4FfjByimrGiIvHHNnLO7rxbXfK9jbeZGefcqJBdcp763dP9jMJ lA97Ts7XSV1hYEYTvhgnBtHU8IlSUwQfGFkIk3Y0lCtmdt3oPjnlXuXLCUsxlP7qqe1O AMWv18hVYHZHdWptb6otroc6T8BYT8ci3OuLRZlKzHm230OdWOF4lyUtJMnoYoG8yIF2 P4xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AhW0Cn0f; 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 z20-20020a63b914000000b0052872c32995si2534364pge.724.2023.05.18.16.09.49; Thu, 18 May 2023 16:10:03 -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=AhW0Cn0f; 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 S230480AbjERWkX (ORCPT + 99 others); Thu, 18 May 2023 18:40:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230350AbjERWkU (ORCPT ); Thu, 18 May 2023 18:40:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E51E6E6E; Thu, 18 May 2023 15:40:19 -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 82A1E65290; Thu, 18 May 2023 22:40:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A613C433A8; Thu, 18 May 2023 22:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684449619; bh=SJxI8K9C2w5GlQmZqTJRQSZCMc1JRXWEVEA8cvqdWaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AhW0Cn0f1RevzDaWU0j6r2dq/quj3SUeeEW9Q9uD+27BTcyCxAb8DWP1oDoUuMmXw 7ggKr9g+nTi86Tpgg7dH1+pt+DGTN11r3tG+SXLNV6vQrRBNH7WNq/SrCE1TKXwsMU Adz0O/wz/WwiebYlIBVbmv7NPVkv5x9/gLFBHYBgdcAfW7ZThG9JqZFxL6ucL4u9nI K4Saj11CePhstbNsuvKC6qqEhRwOvzhxXj2bfPFN0cfN5mcXh6f1dnHDuT0lKoZ1Uw 468aEX5WhFycuC7x24O6V3IQgfcdhGg4/u4Bk85AWG9IdvvvL0ihojMMoW2FSxfvET xxvGip7ZvV0PA== From: SeongJae Park To: paulmck@kernel.org Cc: SeongJae Park , joel@joelfernandes.org, corbet@lwn.net, rcu@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] Docs/RCU/rculist_nulls: Fix trivial coding style Date: Thu, 18 May 2023 22:40:05 +0000 Message-Id: <20230518224008.2468-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230518224008.2468-1-sj@kernel.org> References: <20230518224008.2468-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?1766275315458811010?= X-GMAIL-MSGID: =?utf-8?q?1766275315458811010?= 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 --- 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 Thu May 18 22:40:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 96086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp855842vqo; Thu, 18 May 2023 16:07:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6MZsT66UYNSM/raQmrRaHHah2ASzPn2lvk8N9D4BEhybH+J5bx4JdxqAoVp3GHqsjhB1gP X-Received: by 2002:a05:6a00:2314:b0:63b:6149:7ad6 with SMTP id h20-20020a056a00231400b0063b61497ad6mr393726pfh.34.1684451233670; Thu, 18 May 2023 16:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684451233; cv=none; d=google.com; s=arc-20160816; b=cP34NpndOXZYIjjklt2d8MNLqPPiYEsbO7Hh31aS+pJvej6OsysLFNphjLh4Kcs2mq XxadpWdLqVLmvzsuEtdhPKr3gXOMgpsLg+QPfEB1TNl2sGVi3R908Rbg8Ve8Wi9+UWVu PFkuNtoiEQFmpcYl6+xWtsSlwsX1zZQ0YZr27KShczUgGWHspK3iHb8dRV6hckdleusN mMGOefvysR3Qac5JQ8fCnut/boZS4mGyRtNBCdbhm0aZQr0S4rXpGXloH+HN7MnJB4B5 BBRXCaNr+vbg8dP+e4zGAaIItE5ftAjaJRghFWR8BL9ulyW461Ir5wdPGnMHZW0ozq/r VRyQ== 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=ZjH9Yv1APmyAavK/6RwG0/qX85VAXU/953EWt9r0i1w=; b=AaXO0CRQ9Hi1qiLuY2Srq2Z2tmvcsWBQgAaalgzPLk56nNYTouHg46OiFCoCrRwNMe SwMvS5oN1OdqvVlSQ7JDmLUkbmMarVaJOTUbZY3MqI+1WSTslNy9rNAshhN68NXDCoGi clONZVIloBYQ1fWy0MqhslsDxUg6Svndaqld+oThHOSG7rdcdrHC+6dkT0+nYVcm3x9q rVBw/Hk5bqa3TuviFpRm1JN8DTXR3V9yFJ47KCKDdCo76AUhuC9itLO0PXcycQpbzlTM S/xr0HzW1Qn4PQtTY3H+Tx4Xw85iQqCVngegqnIBxAUrtQr9LDa+eeRTYgn7CeEYMlES mJ9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gvGqlzOd; 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 i186-20020a6387c3000000b00534769ac796si2185596pge.495.2023.05.18.16.06.59; Thu, 18 May 2023 16:07:13 -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=gvGqlzOd; 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 S230350AbjERWk0 (ORCPT + 99 others); Thu, 18 May 2023 18:40:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230417AbjERWkV (ORCPT ); Thu, 18 May 2023 18:40:21 -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 A80D1E61; Thu, 18 May 2023 15:40:20 -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 3D876652B3; Thu, 18 May 2023 22:40:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E33EC433A0; Thu, 18 May 2023 22:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684449619; bh=pru6AOR5Vm1jRjLusfcHlb0JB0ZcJOquRSj2dOKmD7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gvGqlzOd1Ed6Aksnz0b7RZ42saJtCqIni0wD7N022+7SqFUL2WJ5+nCSFqE19Fe8M JxhPHeidqqtUOLRzsy15e84LHkHlVga9S3F4s9x0tgA3HI5bOSN4ZawZ8PPnuuaU0C Z8Vo3d3bD7zYiMLX36XnTbTKr0a/q+GLJD2HxAECbKKV3of+nqHTsxgecCJ7vf9UYY 7AiImHhPV1Mf6JrxN16OrL4VFTd7d95wc1cjkChLXcd79xN9T9F5FSJZvQ34WEupKQ NJTbA69wTNwn7qsNNfVR1Tm3drppRIJVwOnibRgou/d5KLAeBwVXeCBIYfH+wcV2Pq KTVEsWfPPaUbA== From: SeongJae Park To: paulmck@kernel.org Cc: SeongJae Park , joel@joelfernandes.org, corbet@lwn.net, rcu@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] Docs/RCU/rculist_nulls: Assign 'obj' before use from the examples Date: Thu, 18 May 2023 22:40:06 +0000 Message-Id: <20230518224008.2468-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230518224008.2468-1-sj@kernel.org> References: <20230518224008.2468-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?1766275136890412080?= X-GMAIL-MSGID: =?utf-8?q?1766275136890412080?= 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 --- 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 Thu May 18 22:40:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 96083 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp851636vqo; Thu, 18 May 2023 16:00:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ72NOIB8LVmq2tz1Cf7ceeH0iDZ2ALlu2mtH8Mk4ImS8u9k32NzbyjgyRh8taiTeq95Bs8f X-Received: by 2002:a17:90a:fb42:b0:240:f8a6:55c7 with SMTP id iq2-20020a17090afb4200b00240f8a655c7mr115351pjb.20.1684450843663; Thu, 18 May 2023 16:00:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684450843; cv=none; d=google.com; s=arc-20160816; b=fL74YAqw3HqUEmbm8YK6PfeJ/YCqZkAST5jIGA2vx8/hfDWvoxWNYI2vv4LaXQH5E+ +lGQwcooR/gJrBZRMFCviCdc5IGcK/A12JlmzKRCmoWrwv89tNvl4yijzqwzgX/+AXMv nxGfZtt4xh064DhhHDzp4+MRSNRbPRF3XPATfCj0a5A1ju2VC4rSpQbm9Gj+aw8xz4OL W2Su4kKGYHeUw2jiOuTNug221nhGOdyk9z173IcMU42URQL0+Faxrkra1iotDzyORLj0 HOT3OvVijNSzbgl6ldlNY2JiTqgUnMu3YoSZ24ICqtf1NYwuioanE2gt6Q/sq3DotLPr Bmbw== 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=YstYtaldny4jSC9XvvYNtauqMUhPKo5ar5XcrW2XToA=; b=YDb9f2iatM6bAp4t8OQzrEZWrk+iQjnin/4qemh6rlJvmXdch4x2d1frlW74y27VaV LNkF3zWuEyg5Dkdr1flj1fTPfZ628DRUcC0aVeEA6PDA+vaqRliEdjViHBpJ0YmS7FPU p6rUZYbve9WlXaoj4+Qbyv5IJitZvyU1poPd+ElkFTRhbz+fyw4Z+ek6JP90UJorSyu3 8IFzwDejWFnWxmu/gurMTbnuP8J8eTui7SLgwTMtClL6DIZcyD/Up3CgEoqJhc1q61Ai 5MeFs64NqFEQDQSTnB79j9Fr9l1TLpwjarbA75ZQQun9TY/GkFaJWgAzgYWisVrhwbxe P2BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P18tjltV; 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 d5-20020a17090ab30500b00250c9a70af9si522272pjr.63.2023.05.18.16.00.30; Thu, 18 May 2023 16:00:43 -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=P18tjltV; 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 S231192AbjERWkb (ORCPT + 99 others); Thu, 18 May 2023 18:40:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230299AbjERWkW (ORCPT ); Thu, 18 May 2023 18:40:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6249AE64; Thu, 18 May 2023 15:40:21 -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 E48BB638BE; Thu, 18 May 2023 22:40:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8F0CC4339B; Thu, 18 May 2023 22:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684449620; bh=fecc2OUGYvaY7HhyWoq5AoCd5a8aYFQhBEm7VND8WRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P18tjltVWhrWdAx/t73MdYzudw5rAwtcgHmB/MnIe2y6gVDckQF6FTRGLFg5731sU JE8gbMwtGGjpyk1PixlH1id+rzzkUnMY7HfZjyVRsUV1HP8FnjtWswBasnQXpAHtsp 6ir0BbvnOUsku7PcQI00Gs+RbQmLmmpQ14v5cqILduXW0oWTIcegiWs1T0oDdXfgZi R27bwO9Bwj80Phs8CAWxV7dquax9Pk2BNtHDLSFke/1Fc6SO/V6pXockfnzEc//t3D Kew9iJOBJow0x/qHQ/A+sccnynoNIEtq3gnQjfqjzmQxlnKsu4mtFw4A96Ynsalyfq U++W4rKV2PkHQ== From: SeongJae Park To: paulmck@kernel.org Cc: SeongJae Park , joel@joelfernandes.org, corbet@lwn.net, rcu@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] Docs/RCU/rculist_nulls: Fix hlist_head field name of 'obj' Date: Thu, 18 May 2023 22:40:07 +0000 Message-Id: <20230518224008.2468-4-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230518224008.2468-1-sj@kernel.org> References: <20230518224008.2468-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?1766274727595725371?= X-GMAIL-MSGID: =?utf-8?q?1766274727595725371?= 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 --- 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 Thu May 18 22:40:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 96081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp848338vqo; Thu, 18 May 2023 15:52:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5BnMUrtPLBJATx6LR6MSDeGW/ZtntiA1u1VyecgCYjjkaz1+2TM9FTC6NsqrReWVMBcG9V X-Received: by 2002:a17:902:ce83:b0:1ad:c1c2:7d14 with SMTP id f3-20020a170902ce8300b001adc1c27d14mr634712plg.46.1684450356837; Thu, 18 May 2023 15:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684450356; cv=none; d=google.com; s=arc-20160816; b=odciq4vLDPr5xXQVTzdv8OvOkuvXYnZ++T2umRgF2Y5dN1uf6f8zEOqNxmCNHZ/Ss6 abjS/iXvwGQavBB3wyR2o1rm1V8XRnCTOnMdDElUh6aHlz9P1EmSCpKlWwoqNZcl48PU CIbHi+98rX3dklQl5nfxnEMBoGvOm5tiKpNKvY9od0OukMmTnkP6oECfzdXc7P1nwVjC g2s9yVBCMtMXlFHp2snGWR3JyJe7boJEcMdlmMWBoy9lRxSlb8UERP/WkeMq57i6bbMc BoO8hSrlMCH3C6mzizoqAlUwCQl1HErDq+YdLiLj7cT6cj8cKQS5mauGGjCU2Thbx/pW AXuA== 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=5CZ/ahp6QbzIwrHeRcNr1YUJFcFXDR5dAmZrwm//MxA=; b=Xwj0kX+1S7ZoWs6fVgL5Sbs8MZsHcYu2JOlERaU5HeRBGpJrrCyQDe+lDpToxB5uQA TgxARegxChZ9s9jwdte2BmzCUGEUepN66DYDKp9LjQhQcz2+Ypg517HEFxBFjM+XNAjh uxkItCat2NS6E70VF/Jdb/HOoWNw6pdaOHR9Z9WYhLpf2eypVJyLg/t30N+T7xZ6St4g WiN38lnpScWgRllC65ix17+UNV7LaQH+oR2iCx9Oz7/ijx9183UlhoMDH53Lr4lxDj6A IQnc9xwu1MJjK7WTRUfGHCs+lYz1FsNSCDykoV+yeN4XXQaFfe7iPw4g8DR9T3HLfWY/ yZNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ucL2a7Mg; 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 z4-20020a170902834400b001adc5bc4d8asi2160551pln.572.2023.05.18.15.52.20; Thu, 18 May 2023 15:52:36 -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=ucL2a7Mg; 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 S231178AbjERWk2 (ORCPT + 99 others); Thu, 18 May 2023 18:40:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230436AbjERWkW (ORCPT ); Thu, 18 May 2023 18:40:22 -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 B5D08E6E; Thu, 18 May 2023 15:40:21 -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 96DFB65290; Thu, 18 May 2023 22:40:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D96CC4339C; Thu, 18 May 2023 22:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684449621; bh=mYcPMMrN9V5gypfz26UfLD+vMchASHDokjM0vkhV+Wk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ucL2a7MgZPPqtpXsUTgCswQPPRnexmjCSgdKfPjcP9HjKQ6yaF9WpZbAaPDPjRry9 3uskc28qepqVcPcSg1/M6GwpDedvHESb98wt74Sc+YnspeuSz6Yrmxws30HPnO5JjU XeOTyqZqf7wyLLYouBMz2jaJogzjHzMsmpq86e1WDoOii2tmUpLux40hFMBQaZKbYI Yw+ze0IEjJfdpQYuqXX4HaY/DxINFLsl2Xn7PC18tHnClFpWIvbj2voBBQKBpDOMiA iV6xC4AZkXsJmSzoczNly6SzZXlp7oWaiDzHmxbOY1+I5BkiuyXXxDMTKHuRuWD8/l 0T3wu7dtCsPOQ== From: SeongJae Park To: paulmck@kernel.org Cc: SeongJae Park , joel@joelfernandes.org, corbet@lwn.net, rcu@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] Docs/RCU/rculist_nulls: Drop unnecessary '_release' in insert function Date: Thu, 18 May 2023 22:40:08 +0000 Message-Id: <20230518224008.2468-5-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230518224008.2468-1-sj@kernel.org> References: <20230518224008.2468-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?1766274217473869964?= X-GMAIL-MSGID: =?utf-8?q?1766274217473869964?= The document says we can avoid extra smp_rmb() in lockless_lookup() and extra _release() in insert function when hlist_nulls is used. However, the example code snippet for the insert function is still using the extra _release(). Drop 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 5cd6f3f8810f..463270273d89 100644 --- a/Documentation/RCU/rculist_nulls.rst +++ b/Documentation/RCU/rculist_nulls.rst @@ -191,7 +191,7 @@ scan the list again without harm. obj = kmem_cache_alloc(cachep); lock_chain(); // typically a spin_lock() obj->key = key; - atomic_set_release(&obj->refcnt, 1); // key before refcnt + atomic_set(&obj->refcnt, 1); /* * insert obj in RCU way (readers might be traversing chain) */