Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2536890rwd; Fri, 9 Jun 2023 12:47:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5QKK0qHzzDFLuMO7ATRKWo5OnO/vuzo9us3ynB7sUIfSdICzDsNZarCJMJgEyjeB4pGAaN X-Received: by 2002:a17:903:2347:b0:1b2:450f:996 with SMTP id c7-20020a170903234700b001b2450f0996mr6368487plh.23.1686340063682; Fri, 09 Jun 2023 12:47:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686340063; cv=none; d=google.com; s=arc-20160816; b=YBoUD/tPxiMPsNqSYGmXETRCS8Ux7VZffpmcJ1FIPC9WRQHckaXhmuRfBDL70t1sID ElF9e89KpVLNJa5HxW1/SiS0dw+kX6TcJc3W1sX/8eQeOXmmm88NhURFYIscGITCkN8c 1/jViqCkyUsxelJ2i2Lyl0RPv2M7FRzRchNb9hE3i+B3p5ff4UQn4hEkiw6TLtl4BAsF AAtAMg8+u4pmMrBVNAU3VZxdagliAmwNfF3hrPnR8zSBmPeLOD8Kg28lAPgYZWgQGK4D Po//nttjijDJkbjQhYzmzEE5WQsKN3f/hqhbXTtmCm/WrXNyhw2hWOQlzpFLYTMh/iAU A0WQ== 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=HUwLBXiPaUwu04W+9MYfJBk4m+coxKfSVtmzCU5TLOU=; b=VQ6OL360Z/5JxkorW2qF2XCP1bVKyxkyDBF7d077ogsTJtVaBV01gon6hDWmZEQ+L9 IFciExvFEGb9sUd8IvCrQBBZEfBlQ9tbCvhVdUlxLxdYsuIDhqkzpUAjwxo3mmy389OO PEQ/cASIS3zLeV3VYQaJoNh3Y5IQBomACjWGszjJ0kuKvjID1Vrd+ArCoRniOVEOHxPS +l1sTvdY1bpjzfskPximDkDZWw3jXT26yaaSRkLOQxSTWKIukaasUV6WNcvAUPm7m55i cQyXc9g/rL4oQ6BrMOeLu0BhxqhrqU+akUGy2a8uvf2vh8l2FtzizoqwfqAutEEOperr eeXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nXyUBVzv; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l4-20020a170903244400b001ae6948b4a0si254647pls.501.2023.06.09.12.47.28; Fri, 09 Jun 2023 12:47: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=nXyUBVzv; 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 S230016AbjFITMM (ORCPT + 99 others); Fri, 9 Jun 2023 15:12:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229644AbjFITMK (ORCPT ); Fri, 9 Jun 2023 15:12:10 -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 00F751A4; Fri, 9 Jun 2023 12:12:09 -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 8997E611B0; Fri, 9 Jun 2023 19:12:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 628F2C433D2; Fri, 9 Jun 2023 19:12:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686337929; bh=KFNOV3o4cqtQYNywig/OkDKy4bUHopCwMFlABCAl2zQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nXyUBVzvCMSSoCB+HWwPC+EduJ1s0zzgtsCoFlQp/k4a/Yg37cO5twLzXZYmhhNfY ywrwWgFT0+H7daHKQfEdQn2yfabwnOqdu41l2ruM993kQ8WmX+EuekP+WtfxyLk/vj waVl4IAMZW0Y2i5lESWeJsBZHkCQhtU6jgv+j9tsxHn5zWpT+M7aqcmobKNEshZ5D+ he9Zq5MwPM7wD67cvQ2RAwCSp3yA1ptrKhY5UjXueJJNfp6r59XLKtKSubGNKNK8Rb 3AdJKu7vWZ/ykO1d/KfIuWysfwQnzEMQRd52WOXjmCmfRbXKke8BBE3yhZovpqZASD KmIO1cZ0ZXvKA== From: SeongJae Park To: Joel Fernandes Cc: SeongJae Park , paulmck@kernel.org, corbet@lwn.net, rcu@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] Docs/RCU/rculist_nulls: Drop unnecessary '_release' in insert function Date: Fri, 9 Jun 2023 19:12:06 +0000 Message-Id: <20230609191206.30465-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 On Fri, 19 May 2023 14:52:50 -0400 Joel Fernandes wrote: > On Thu, May 18, 2023 at 6:40 PM SeongJae Park wrote: > > > > 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 > > --- > > 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) > > */ > > If write to ->refcnt of 1 is reordered with setting of ->key, what > prevents the 'lookup algorithm' from doing a key match (obj->key == > key) before the refcount has been initialized? > > Are we sure the reordering mentioned in the document is the same as > the reordering prevented by the atomic_set_release()? Paul, may I ask your opinion? Thanks, SJ > > For the other 3 patches, feel free to add: > Reviewed-by: Joel Fernandes (Google) > > thanks, > > - Joel