From patchwork Thu Jun 15 18:10:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 108680 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp837635vqr; Thu, 15 Jun 2023 11:32:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ59vgAB7lqj0YxEfLvph/+EFh5PXc4FAR0N2zl2S0uMGiSB5K2xhCRbLhqAs9/yiInhMKaj X-Received: by 2002:a05:6a00:2d0e:b0:666:7bc5:531c with SMTP id fa14-20020a056a002d0e00b006667bc5531cmr5488670pfb.24.1686853963640; Thu, 15 Jun 2023 11:32:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686853963; cv=none; d=google.com; s=arc-20160816; b=zB2cqKPycFOlIV4s43JPfzvpmjBGiDkq65i9aUeODu9nDFul+DH5Rui4m6wgnIP/B0 Ju7R3Q9FMtXj6OOMNvOO7okSYMBcU40bCukBV3Wuo7X2GvpRByZF/MMVsb0A8PXxc6Rm RtzXlaBYaSlkf5NDUpvkzd9F5HY0t7fH6gQtyq4uHHAd687bmGwCcAC2MsB2TwqaAcJA b2k6ql73AbY6LRRuxCxHub+5idx71Ne7dHgGnGe1tG5atpL7oa+qD3vTdK68jhS2IH2P Esus1knziP1GsQkCz2zaAOgieKNvldqY3hsoQriJ7pAdlEjltAy/X8jTcuzoLrIPmXVT IwlA== 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=2fyEjJpA17f0rk8BRxwXcaYYxRsyKEc9xHuiT4Y0zJE=; b=kzwfiuC2bO3w/vrkjgk7a/gBEF6/gqt4IZReQCvBvP6+cRvn1FRnZTnmUul/3nCscZ wA/gccyzjmq0FXeS/p0SNwIjme2emtb5qdiRDHUfsvjIV0QWDRGXQqoy1b0xPz6OsfDs 2PfQv9rvoafUb4+gzf4wHvHt97UFOMgsRsSy0gCWuCy/rlfTkblWi1bz/MX6SKZ8Ikar HxZ4GpCBAIhPRGxRR+8005/kbsKS0iurLsQqyZDChOjwyFh0PKea3wsUve9xljlY5LM2 pt/2Zceh9D/pIcYKIOrKc6ZdqhLmuDn0xB1LppigHfOpxVJbyVWbpGVW3jf6F/1CSGeB VH2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CEZlK7GC; 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 bm18-20020a656e92000000b0052c7ad564e2si13839673pgb.707.2023.06.15.11.32.31; Thu, 15 Jun 2023 11:32: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=CEZlK7GC; 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 S238307AbjFOSKX (ORCPT + 99 others); Thu, 15 Jun 2023 14:10:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239387AbjFOSKM (ORCPT ); Thu, 15 Jun 2023 14:10:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A2792960; Thu, 15 Jun 2023 11:10:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8905A6102A; Thu, 15 Jun 2023 18:10:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 586F0C433CB; Thu, 15 Jun 2023 18:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686852611; bh=U6h6ZVnX1R+TPZKq+FI4cbLfEjWQ4SmBj/oLpCWrvdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CEZlK7GCdb9WE0sL23de54xVIUpj9JSjgpgizcOcQf65VgF3Y9YHrYcfE36RoYDCO jlJ9aTzLeztjAvJXhDxv2B5P0KPrtyFgHMch9XmU0P8ntPEwAdbRZmCJSEA8QNgIl5 GHORoF4RnwMkZBg4R3XkoY/ZgR7plNGJPf/PgBmAg9ybrQJQACTyOc2Apw12Ncvzvg 60BncB3GqgSNcWwqxv0UD1+YM+7dpRCKg5ewIUK+kNz1+D/h/iittKEKVOM2hw8HvI s8tNTMRPDrAQav5j4OXBCCjIkEO1czVyUaVt7d9u1bSqj3WJS02mZcylu0xF5xAEAB KfXc6WUzD9QgQ== 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 v3 1/3] Docs/RCU/rculist_nulls: Specify type of the object in examples Date: Thu, 15 Jun 2023 18:10:02 +0000 Message-Id: <20230615181004.86850-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230615181004.86850-1-sj@kernel.org> References: <20230615181004.86850-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?1768794581619921634?= X-GMAIL-MSGID: =?utf-8?q?1768794581619921634?= The type of 'obj' in example code of rculist_nulls.rst is implicit. Provide the specific type of it before the example code. Suggested-by: aul E. McKenney Link: https://lore.kernel.org/rcu/43943609-f80c-4b6a-9844-994eef800757@paulmck-laptop/ Signed-off-by: SeongJae Park --- Documentation/RCU/rculist_nulls.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst index 94a8bfe9f560..4b66e2fd2fb5 100644 --- a/Documentation/RCU/rculist_nulls.rst +++ b/Documentation/RCU/rculist_nulls.rst @@ -18,7 +18,16 @@ to solve following problem. Without 'nulls', a typical RCU linked list managing objects which are allocated with SLAB_TYPESAFE_BY_RCU kmem_cache can use the following -algorithms: +algorithms. Following examples assume 'obj' is a pointer to such +objects, which is having below type. + +:: + + struct object { + struct hlist_node obj_node; + refcount_t refcnt; + unsigned int key; + }; 1) Lookup algorithm ------------------- @@ -142,6 +151,9 @@ the beginning. If the object was moved to the same chain, then the reader doesn't care: It might occasionally scan the list again without harm. +Note that using hlist_nulls means the type of 'obj_node' field of +'struct object' becomes 'struct hlist_nulls_node'. + 1) lookup algorithm ------------------- From patchwork Thu Jun 15 18:10:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 108676 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp826807vqr; Thu, 15 Jun 2023 11:14:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7OcDDCp7rBAIvwh3OZQJJvyAxZhQeKlrvDICOyajJfnaEc4eCKmonNvzH6fXJZtHssYMU5 X-Received: by 2002:a17:902:ea05:b0:1b0:62e2:1f84 with SMTP id s5-20020a170902ea0500b001b062e21f84mr7304712plg.5.1686852869015; Thu, 15 Jun 2023 11:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686852868; cv=none; d=google.com; s=arc-20160816; b=lSVCKPvssCp9YcuvzLUx01+tU9cELUhpUEC8rOWhlnc6/PoORsB1Jkq14U0zvFnPjD TEQwMUpmlXeMp11+bPVGbGPmrD2HyRWI9xpCQ+FuiQ+KW+4fhp1epifOvRpOmxICpBwi o1fE4uHNSQyzdVczELUO/FKwPTmQ8RJ7+Giqpvrp43ROW8FJI47hEZY2D/YtCSSesp2U /Roq1mkxstAnhqsMDW8Nt7EMDft63iBykwuQpVmFO74zCU1BBhJym8PiuicyfxPmSy4M KniJJFGNEJzJmeb3mRQh6aUNE6SF90AH/3AxieBuDJsAJH2Yugu7pguRZnkBU9fXrFUM gn3A== 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=2DUkFDXVxWSeUw8jnmQvHS6FBLIqk6q7IjEZVAMVUFc=; b=EQa88vGnmYuTLPxwpjquQYzzxhZdiySWSpLaeUl6iLStFOt/qX2JOlnwSRQl0hEan3 SAtH+pb08cRPvb2zSy3SXoh5iOHg5lq6FD0rZjH2BJ2pciPLtrXN7Ii0l4z6GqrGm/td pgmBRHI42yyKIOkVyEDJsMl6edXqPunJay6x/Mup3xqkQ5Re8q8X9bPyZIKky06Smnvo S+iUL9nayTc/irrIcuiAJBf0rZm6IxkFG4Gi2cTN37Oj3FNhCCU0rj/lRBEscr/tnGDa iMjxe13N7/Z4TthtoSqAeR0uufdsQ9VZgWx1gJ24xK/NHmWRhEBFvOPnAW9KdwN7GcX1 WZUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I0z65ADi; 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 l15-20020a170903120f00b001aaed82c2afsi13982823plh.171.2023.06.15.11.14.16; Thu, 15 Jun 2023 11:14:28 -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=I0z65ADi; 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 S238198AbjFOSKU (ORCPT + 99 others); Thu, 15 Jun 2023 14:10:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239403AbjFOSKN (ORCPT ); Thu, 15 Jun 2023 14:10:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4CDD295B; Thu, 15 Jun 2023 11:10:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 51D8F61B53; Thu, 15 Jun 2023 18:10:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31B7DC433CA; Thu, 15 Jun 2023 18:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686852611; bh=LmZp49bujap0FTIZFNAjgmpNWjLBvfyY95sutmfr3+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I0z65ADiAyCKOR5m6JF1PbHdbNM4ZmghQ5OQ4yv+XKhkevdpcC/ZohV0VrPfJf9pS cpWNYWx/mCgQYAtQvH453C8EsIKCD812AlfSG06/IWxk83+ZcnkP6vOS3WKGxVXeny QQ6agvN4Mx5e05DClpoq2uACw7grNLMcKj+ubI1cVCrBOsZ/TF9hioKzc16IelEDws 1FLeKO+irNBu1zMl0dtL4Re4406jhXNOZrc6XvGx3jTOV1+KaDq3fiVoF67cYDPA+K BP9JVFHkq35qBwLCE0DRmkIdanrbxvb5oUkQubgmdnX1VrFzSXJNBbYTW7HGwNZVXQ vEcQ4o6XC8kQw== 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 v3 2/3] Docs/RCU/rculist_nulls: Fix hlist_[nulls]_head field names of 'obj' Date: Thu, 15 Jun 2023 18:10:03 +0000 Message-Id: <20230615181004.86850-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230615181004.86850-1-sj@kernel.org> References: <20230615181004.86850-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?1768793433808992906?= X-GMAIL-MSGID: =?utf-8?q?1768793433808992906?= The example code snippets on rculist_nulls.rst are assuming 'obj' to have the 'hlist_head' or 'hlist_nulls_head' field named 'obj_node', but a sentence and some code snippets are wrongly calling 'obj->obj_node.next' as 'obj->obj_next', or 'obj->obj_node' as 'member'. Fix it. Signed-off-by: SeongJae Park --- Documentation/RCU/rculist_nulls.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst index 4b66e2fd2fb5..a24783ebc5df 100644 --- a/Documentation/RCU/rculist_nulls.rst +++ b/Documentation/RCU/rculist_nulls.rst @@ -63,7 +63,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; }) && - ({ obj = hlist_entry(pos, typeof(*obj), member); 1; }); + ({ obj = hlist_entry(pos, typeof(*obj), obj_node); 1; }); pos = rcu_dereference(next)) if (obj->key == key) return obj; @@ -75,7 +75,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; }) && - ({ obj = hlist_entry(pos, typeof(*obj), member); 1; }); + ({ obj = hlist_entry(pos, typeof(*obj), obj_node); 1; }); pos = rcu_dereference(pos->next)) if (obj->key == key) return obj; @@ -95,7 +95,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 @@ -163,7 +163,7 @@ Note that using hlist_nulls means the type of 'obj_node' field of head = &table[slot]; begin: rcu_read_lock(); - hlist_nulls_for_each_entry_rcu(obj, node, head, member) { + hlist_nulls_for_each_entry_rcu(obj, node, head, obj_node) { if (obj->key == key) { if (!try_get_ref(obj)) { // might fail for free objects rcu_read_unlock(); From patchwork Thu Jun 15 18:10:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 108677 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp836171vqr; Thu, 15 Jun 2023 11:30:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5l7BbWqHtj+EfuFKRZu81Kkxno/QAB1lL/g3f7dzscVMbs1a0KjFq7qYbXrC49MDMZHX74 X-Received: by 2002:a05:6808:234d:b0:39e:769b:a8a3 with SMTP id ef13-20020a056808234d00b0039e769ba8a3mr96459oib.3.1686853827633; Thu, 15 Jun 2023 11:30:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686853827; cv=none; d=google.com; s=arc-20160816; b=e+cQrIg8YPhG4F2yd5YnuRLWzgJFSpkvZaYWp1ZIHUKahbavhhjONV9JMpoGaj3JlD vpRcqYeO6r6MPBkF+h5cadk7bbWZxoKI6arOs20gLY2OX79p18z6XbI1+5cg8Z8/UO/p +1s7lufIcrt/GH7cM3ZIP4NYvdybfSM9NSt2NaA+tdDoV5Nb9whbSBVdY74HX1qJqb+C sRE9DWzSIWHW/yfw5eIozfrZGFcpUhXzR8DS9YqmUtxgSe9AHczfthgMF7p2Spsn/lrj 7e9jveFb6v62vJePDmTx9H9LenFkLLtmoDs+6lfCkkr2BQGFwpTJMidxd6cLFeKHtOIh O4LQ== 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=4dsOltpRHgXuuR1dq3mQtBz5QxKOwiQYmQNzw3lNaoU=; b=BmCVFJbdGmcECoKXXEhsa93M/SjKjTnJ5iSksQy+9Lu786qO25VW9aV9T+WfmxX0uW OxGCM7aL1RAE84nZy5lQ+MuzsvObrNIywUEzMmy0arFV1l7fE6P6wDv4XDjnxwR4XMzU psiqlLUlkiG90CSlPtYHjqJWequlwZRHf7BPsE6rtHiVxsM0ujuwRwB+HhaetJsiVw1h pzJx7sKsbIMn72Adl8i2jmXWsQ/mIL82S42jqxqImXoK8S/g7/4soIc30TU2KQvM+rwp 1yc/qtix6AD7rnM2Y0zfQ3hohLAsIvccvzTImcg4SvuqRy8TFr+FvYMSNN9FALiCSjCL LKbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Dg7w2Q4e; 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 u63-20020a17090a51c500b00259b538399csi15158570pjh.46.2023.06.15.11.30.13; Thu, 15 Jun 2023 11:30:27 -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=Dg7w2Q4e; 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 S238703AbjFOSK1 (ORCPT + 99 others); Thu, 15 Jun 2023 14:10:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239424AbjFOSKO (ORCPT ); Thu, 15 Jun 2023 14:10:14 -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 87A5C295C; Thu, 15 Jun 2023 11:10:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1CAFA6104D; Thu, 15 Jun 2023 18:10:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2046C433C0; Thu, 15 Jun 2023 18:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686852612; bh=BGArqnN0cuqkluggRcsoV7lA0nFMtudLK2PV5oM2SLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dg7w2Q4eFBTgBpgKnDq/sZZYe9EfGxulIUr82J0bCnZopXm069n/34WAAy6cD1vwO dzVlmrSLFAD9Sd4IeMhdQzy/4UuFJHbwdfqYhJCzcymyt8womLR/A7PUUz0ysTA8rR oMM4HIaFoENgdA5jVNwq56H6Y4Vj6qw+ydz/xi1aL4OcVDhaozOjSqQdQTKLOekGY0 tXStzxRXsroFSKaIQLBd6aPC+ZuGJv/pK05PSu9p54+3pFkAAA6wNnzOSEd8g9wzio ARHwJ7MqtcKwaIk7vB00eLmLl2jS7UivS148GUWuxkwkfhx7+hKzgIRjo3ulzQWGGp Eml0K6jEmwbBg== 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 v3 3/3] Docs/RCU/rculist_nulls: Fix text about atomic_set_release() Date: Thu, 15 Jun 2023 18:10:04 +0000 Message-Id: <20230615181004.86850-4-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230615181004.86850-1-sj@kernel.org> References: <20230615181004.86850-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?1768794439376326175?= X-GMAIL-MSGID: =?utf-8?q?1768794439376326175?= 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 a24783ebc5df..58a32dad21b8 100644 --- a/Documentation/RCU/rculist_nulls.rst +++ b/Documentation/RCU/rculist_nulls.rst @@ -138,8 +138,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 @@ -194,6 +193,9 @@ Note that using hlist_nulls means the type of 'obj_node' field of 2) Insert algorithm ------------------- +Same to the above one, but uses hlist_nulls_add_head_rcu() instead of +hlist_add_head_rcu(). + :: /*