Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp394576rwb; Wed, 18 Jan 2023 19:44:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXs/OF0ooTTPv4MkFhVAcqKjmmh1TcL6bX417CF43/je+5UpMfbXOez3/FzncJjmCgoSddDU X-Received: by 2002:a17:907:b9da:b0:872:21b2:9a1f with SMTP id xa26-20020a170907b9da00b0087221b29a1fmr9891593ejc.58.1674099844859; Wed, 18 Jan 2023 19:44:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674099844; cv=none; d=google.com; s=arc-20160816; b=pCXXoBdYvXJcn+4dv13318yneGz5pIKEXX+6FcLQwp+rJVUn0WGPbCx5L2zfTki4oW uMRFinD69rjcfER327B3n1AF0T9SN3lRuWyzybJUh/O8tTK28xDcsK9DWs/48I4jvb7t lJW/Lm9ILVpoeLMo78eDkas7CcCxwr0zQGU6rUbT4UudT4jktgc072hE2WKD0TUDN3Xy rqf7tT8WhZdp05Gd3CuXoCftJvdyi5JkFHAlzU8kgaWVWaWjdnVXz9ZHLsOdSQinOAez xK+C1IRb6HnN9juyB474kUdGOoLdkp9Z2vIJ4H31n85r9gqWMXFroTZjIRmLLrNuKxfP aNsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Lw1x64NYSV6Qp8iG+MNc6IVeo8DiPjtmrZlFToz/5QA=; b=N+1woKGZp+mZGvJVzu0q7X3yR1MAvOgFbE9182ips4enbdTEouZqiSMDQAF7C1F6hA cdvptOu+oZshI0YugQYkYMXTweFnJSzLDEqSDSZajW+4uo65OB2a7ko9YwspIIP/dkN7 JYnvGyVvOxlB5/SgaED4AF95TFP+MveP5afkd23eSg8XVtEIS2tF7/Pu+EmMz3VD+6xF ZNJ4Eq9reGT2JWS0ylrfRyJgKVcObvXbQnre+M1jEXg0Hbubob+c0kfVSS4OJqEml0Fo nUEmDJt2aLE/PSYWs0ruu5rXP58bdBZaC+vAI+egAT3brMU4YEXJUnkkladGpsbRIhxV 3V5w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh32-20020a1709076ea000b00870b608e433si7410434ejc.36.2023.01.18.19.43.54; Wed, 18 Jan 2023 19:44:04 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229904AbjASCTQ (ORCPT + 44 others); Wed, 18 Jan 2023 21:19:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbjASCTM (ORCPT ); Wed, 18 Jan 2023 21:19:12 -0500 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 5E08266EDA for ; Wed, 18 Jan 2023 18:19:08 -0800 (PST) Received: (qmail 233345 invoked by uid 1000); 18 Jan 2023 21:19:07 -0500 Date: Wed, 18 Jan 2023 21:19:07 -0500 From: Alan Stern To: "Paul E. McKenney" Cc: Andrea Parri , Jonas Oberhauser , Peter Zijlstra , will , "boqun.feng" , npiggin , dhowells , "j.alglave" , "luc.maranget" , akiyks , dlustig , joel , urezki , quic_neeraju , frederic , Kernel development list Subject: Re: Internal vs. external barriers (was: Re: Interesting LKMM litmus test) Message-ID: References: <20230117151416.GI2948950@paulmck-ThinkPad-P17-Gen-1> <20230117174308.GK2948950@paulmck-ThinkPad-P17-Gen-1> <20230118035041.GQ2948950@paulmck-ThinkPad-P17-Gen-1> <20230118200601.GH2948950@paulmck-ThinkPad-P17-Gen-1> <20230119000214.GM2948950@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230119000214.GM2948950@paulmck-ThinkPad-P17-Gen-1> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS autolearn=no 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 Wed, Jan 18, 2023 at 04:02:14PM -0800, Paul E. McKenney wrote: > On Wed, Jan 18, 2023 at 03:54:47PM -0500, Alan Stern wrote: > > How does this differ from srcu_read_lock() and srcu_read_unlock()? And > > how do the "up" and "down" parts figure into it? -- what is going up or > > down? > > Functionally and from a performance/scalability viewpoint, they > are identical to srcu_read_lock() and srcu_read_unlock(). The only > difference is that srcu_down_read() and srcu_up_read() lack the lockdep > machinery that complains when a matching pair of srcu_read_lock() and > srcu_read_unlock() are used from different tasks. This makes me wonder if there's any need for srcu_down_read and srcu_up_read at all. Why not just use srcu_read_lock and srcu_read_unlock, and remove the lockdep check? > Within the implementation, nothing ever goes down, it is all > this_cpu_inc(). The "down" and "up" are by analogy to down() and up(), > where "down()" says acquire some rights to a resource and "up()" says > release those rights. Another reason not to use those names. If you insist on making these operations distinct from srcu_read_lock and srcu_read_unlock, why not borrow the "_get" and "_put" nomenclature used by the device core? I suspect more people would associate them with acquiring and releasing rights to a resource. (Although in this case it might be so clear exactly what that resource is.) > Wait, I can make "down" work. > > A call to srcu_down_read() reduces the quantity computed by summing the > unlocks then subtracting the sum of the locks. A call to srcu_up_read() > increases that same quantity. ;-) I can't honestly call that a resoundingly convincing argument. :-) Alan