From patchwork Fri Jun 16 23:36:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 109387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1684716vqr; Fri, 16 Jun 2023 16:50:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7F4jWx1y2RPa95V8mHw6amgSvFqaGLIROSUC2JLAKbxRf8KgL88vc/0ks2JjA7IUc5osyl X-Received: by 2002:a05:6a20:c789:b0:11e:18e:a105 with SMTP id hk9-20020a056a20c78900b0011e018ea105mr3887871pzb.55.1686959414351; Fri, 16 Jun 2023 16:50:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686959414; cv=none; d=google.com; s=arc-20160816; b=nIoinF7er+QpwptWC0Izae7jkCZSkOgNUWFAb2VE/aGF7ToKk/Um3W+hhfyPS79Yuo WZh98J+JutC/PrfSHSisSbb6uoRjvGdnDOIQGdz5rU/Tn7dKDQgvjL1cGC2em9KWsTtW WxvA+rkj1siHkd5Rcf7MiNmYLhczqEEmgMMycH9/BgLyJ3tSJCDclETA2k8hlc0AXjjU +JpnKMDMhv3N6pISezdq9qaJJHyTyP0y7jZPGAxKUE41HxO7tl5Z2f+hdG5djmQ/mZe4 2L/7SUCsrKhbbVuVr7snR+i20XJUx/jWDtFv+43z/BTgrFlG01Pu34h+pXOhWYf7s2PL PyBA== 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=XXCKgMDYCTj1E8kXvTitG6SOSFZXS8oJj7piZVXs/rc=; b=uEJG2ObZcpVrpZz/cHkrbOluDlmEtbcbSiaMO7VevTMutiD8hwYXUC+nHvixsFRQ0c DG2/y/69SKQLkNn/OP0v7BVBqMJCTkktpK5yPkSJmv25bm1ps4y+9JXsr5G4OGWoD/8C epPrvExlxTJyMGD9v7K8YtaBspxZp6eysMaaEOg1fwOseOCPLzrFyuuMhG20VjKxl/CI WoZShnxtJr3s8uOmCQnmeB1Zus45m0qikBb6UoudTzF9oo7xFcEHDAdtAV8WKKtVDVoY YX5zIUjuHZSFM2ST/lxfO2U8nFCTaiLbyAxgwkhwSVXOeXqitB7VG7nQIWHwmDcDh1IO BCNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=K6iOOxAI; 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 l186-20020a6388c3000000b0054fe20a34b2si5721617pgd.850.2023.06.16.16.49.58; Fri, 16 Jun 2023 16:50:14 -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=K6iOOxAI; 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 S1345775AbjFPXgk (ORCPT + 99 others); Fri, 16 Jun 2023 19:36:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345777AbjFPXgg (ORCPT ); Fri, 16 Jun 2023 19:36:36 -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 5D03A3AB3; Fri, 16 Jun 2023 16:36:33 -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 E69B9623C4; Fri, 16 Jun 2023 23:36:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B90E3C433C8; Fri, 16 Jun 2023 23:36:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686958592; bh=Lcfm0OdItYB2zZ/FXd8OC9BkWFuELqxJlr2ec9I0ACI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K6iOOxAImFvfzsq3NLrXc9ruXfxNGqrgXYH/eyLxngnCVEL/jmDC9OccFZ+RLMrxa w2+woDg/eqFXS1GB2sBBnxNNxId+ZvRFFuUx7wQANr64cj/vKQjQGbMIGJxjU3alTW 0wPb8+l+ldF5OEFSQF6pkL/EcaP6utn7hcSIZyrZCcRdQ3zrywjt5hQhBoA31Tm3DZ oVG8wbkw+e5fqOXDDEc5CUFJ/XWRyipqd7UdboPEldHvjky6zBg6RfG0uWQ2xC5i9p 7/q6qsgdXlXL1k73LYccPkm3fFVF20Z76QevEhsR+2KUAsbkyFqx2KZCgrAE+2rjHQ cFj6tqhkRHuKg== 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 v4 1/3] Docs/RCU/rculist_nulls: Specify type of the object in examples Date: Fri, 16 Jun 2023 23:36:24 +0000 Message-Id: <20230616233626.83906-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230616233626.83906-1-sj@kernel.org> References: <20230616233626.83906-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?1768905154872231837?= X-GMAIL-MSGID: =?utf-8?q?1768905154872231837?= 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: Paul 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..a6827cc31791 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; + atomic_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 Fri Jun 16 23:36:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 109388 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1702286vqr; Fri, 16 Jun 2023 17:35:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4trPgwuB8e5eWQQ1aBQkg2QCXBFJPiMPlK2vDrOS+8fMdR1NSCGHXmVGvZM7EbG0MxGfP6 X-Received: by 2002:a17:902:f542:b0:1ac:b449:3528 with SMTP id h2-20020a170902f54200b001acb4493528mr4403751plf.46.1686962100335; Fri, 16 Jun 2023 17:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686962100; cv=none; d=google.com; s=arc-20160816; b=YLib7SPS7UMR4SXEa+TWQAhQfOtYfYzsINEhzOiXZ1wrsVbIggGzkz31YCfYqQlU6x 722M8gppc5JLRYUagbq16ELGW7ZNiinzd47QlVGyonsL1sWulO0HZnw5ffEN2CCMgl95 X7L2AlKkzjw49SgeoDoYr8OBDp7Ux4OobKFZZHt0zUIJC5yD/1wx8E08SyjEt1yv6FpX 6KUmMkVQfo4ZayImvs5uZQgdJ7wxEETDEFloPMbXgkTrZvsOo0Z8pF2eh3/+fSeM9Upd WPaz4xQm/wqXekh2ijaUY3OMPxIVQBpGv4Hzd5/Lkuk/VN4FT0cvIvzHE3hOi6wpYHJD ik/A== 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=4AHQs7DO+kcT0HI+qJXK1jku3gcMsAa3e0krNKzTkvw=; b=kizNu1eyypxI5NutXRL2vD4ve3m8XeK9Y9oHtYkIzcK4NnLfXz39Dh7YZjYgBHF8Hw oLPG1ElGpF5yjvq8VcfxbG2ItmRIN22kTczGzs0bV6Uhsu9EdiM2rsCGk217HSO7HcqK 7sB2hs6svi5JCykNpai9GKC1xIv215G88ZBEdLWBGGvzmvvUvDto989wzSqJX0BbCujA ed+F+PUumpIh/AeacBzN1YwhIop34+c0pDgbfup3yOUytWKfmM7jsvJmmkG0/YWIhXL+ 8a8VkqpAGREph3D+//djVih4Rev4SsjuTx39bG7u22CAxBmhnXRcuULJ5wm6y3buEARz yKQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ia/JrTVm"; 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 w14-20020a170902e88e00b001a979e702b2si1227985plg.416.2023.06.16.17.34.38; Fri, 16 Jun 2023 17:35:00 -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="ia/JrTVm"; 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 S1345823AbjFPXgo (ORCPT + 99 others); Fri, 16 Jun 2023 19:36:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345789AbjFPXgj (ORCPT ); Fri, 16 Jun 2023 19:36:39 -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 4D6303AB8; Fri, 16 Jun 2023 16:36:34 -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 CA76A62F12; Fri, 16 Jun 2023 23:36:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 940BEC433CA; Fri, 16 Jun 2023 23:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686958593; bh=lBWgs+90Gck3vESACjS/SXnoZhAGTUFxSPAqJdGmdaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ia/JrTVmfO6NJ9ySd38aUtF/rqESYfPNIJAzKeZrON1qg4fubp0SM+oq1uibr+yYp oLu7MUKEaUVTJ//Bmrkv2EyBFocI6vbRHHhG9dx9Jhs2/FgmSJC9rmUYaz83TsYZ72 zApvWG0oRnHFRPrUy8qpQieYJaSaEnvma8sxapHlng01nW7xa58jf+RpMAFtI2LYI2 Y6R8dRwPcnoTxzqn3R4RnMNAbhgqgusnSk1hVhobDOGKGwI9JEtxBDCWkpRcK+VEHD xvBgu0QmlVfOlSG/Hyb2n/VLIwUI+/KjIGZmnoMMFCQ6nz+rv70V6odz/EEW/N6irU wmXoZENqEeHDw== 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 v4 2/3] Docs/RCU/rculist_nulls: Fix hlist_[nulls]_head field names of 'obj' Date: Fri, 16 Jun 2023 23:36:25 +0000 Message-Id: <20230616233626.83906-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230616233626.83906-1-sj@kernel.org> References: <20230616233626.83906-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?1768907971465738488?= X-GMAIL-MSGID: =?utf-8?q?1768907971465738488?= 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 a6827cc31791..4afa11f2c906 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 Fri Jun 16 23:36:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 109392 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1703363vqr; Fri, 16 Jun 2023 17:38:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Tx8E6aGBp5E4TNyxEQB0FuemH94pGYPQ4MvFJDu404Pqtz357LboCXKhSgvXT3nJUQzNR X-Received: by 2002:a05:6359:2ea4:b0:12f:1567:1502 with SMTP id rp36-20020a0563592ea400b0012f15671502mr887950rwb.28.1686962283108; Fri, 16 Jun 2023 17:38:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686962283; cv=none; d=google.com; s=arc-20160816; b=Gcs4vEtXwqHpYmr5ewlxrQlIU6HSnuUjFMubAn4qWZ3z016/xfjC3xmPpX2/ND2IRS u91KcLk5ilN9n5SxoF36FwTaPXWz6h8ZGQQONj4EzXrmdYyJjLOiZAHD9YNbaTbIZuzd qi8NDGWjf7NfyeKyXLIV5mDBAp7mOTPBsLolunwk0G5PPsOqVfFix++Mq6NQPbJhbL0o IsvGCLHRisAVNOUuIky7QDI1Y2K80C1GbtgsQiFJzZgenO7s2LLlASWW3s028HwucNmK iVX6Yj7Ue+8rejLFsdz2O1dtJzyu1M7RkKZD8o7gXzmt5WnoV1bxbxxCrq9z+zepoMZN JnoA== 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=1dnD52chPAFDrMTq0C8Ue0v+1slOlxsehx2YZRuzJE8=; b=z9ur8CF8OJSvskrhEYGZS9lrdz+d0/eXganE9dPX0t3eE5gJSGIW86+4S3Y8JxjKcz pNo56HjtGT7jaTINguovTQOpTx/cff9slJRb7ip+7wcoyzrbPGX7MP+xt8OuXHxvDviG jmPgTzk8pOlJIbWVkP8SD7SSvwaJ91U/c+h7Sx2SgXbHs7wg57v88xMJWgISjPWFAQAh K1Mzcs8oiP1w4Ah3gDF+pcP9kkIwDXqD2Kn4XPK2JjGeq5pGonqCT2q9a+Xh8oNR/V32 S1/Fdi92mFifhLoyPCSptbxeEg5zWemRQfptw/kEjxTgPhB/0toP/wVfAeeYy12Kbtuc lB5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CVdz3loJ; 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 197-20020a6301ce000000b0053b86623b3asi13545895pgb.577.2023.06.16.17.37.51; Fri, 16 Jun 2023 17:38: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=CVdz3loJ; 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 S1345966AbjFPXgr (ORCPT + 99 others); Fri, 16 Jun 2023 19:36:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345821AbjFPXgj (ORCPT ); Fri, 16 Jun 2023 19:36:39 -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 129B53599; Fri, 16 Jun 2023 16:36:35 -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 9C6EF62EF0; Fri, 16 Jun 2023 23:36:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FEB0C433D9; Fri, 16 Jun 2023 23:36:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686958594; bh=zT5gbB7rVoap1E8WJihukUSBZgfptu3BhHsTT2AdGt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CVdz3loJKxKxjdEMlRpBM4tKvO2y4Jrovl353vdDDH2FFxpc98MD95I/mEwiT4ob2 8wZZX+QOiS3TLDzQbAAXJqtP541njXoNd8k68OJmrjPXZEkWbV2AVsOA275Fkv+jbC Nu0CkrUx949fmWRdKZA/wrp5lVh6pEzrUFt0u6LChu1Rpxdn0pPkx5m7hxVGEYm7bK 0t1lAeWBRhZUomwU7zVRICIyyjyXXcOBdJ0H6fpjbv3BTHD8wN1/QW4l47DA66Oved vC1Y0VRlM3B5inFxlLn1/QjPRpS68s1ZPO10+fDXtibFlvvppIt8xZAWN3B9Qb2FSC if1YnUwwzSd7A== 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 v4 3/3] Docs/RCU/rculist_nulls: Fix text about atomic_set_release() Date: Fri, 16 Jun 2023 23:36:26 +0000 Message-Id: <20230616233626.83906-4-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230616233626.83906-1-sj@kernel.org> References: <20230616233626.83906-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?1768908162871066289?= X-GMAIL-MSGID: =?utf-8?q?1768908162871066289?= 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 4afa11f2c906..660cc3f0f1e5 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(). + :: /*