Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp477782ybn; Thu, 3 Oct 2019 07:47:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwiA35EUhfolA1UGNK593AQcKSL97KUUpdEJ1ALPdqxeRKZGhJ74BCjmqu6MeDnGezQqpSJ X-Received: by 2002:a17:906:16cd:: with SMTP id t13mr8116598ejd.153.1570114074585; Thu, 03 Oct 2019 07:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570114074; cv=none; d=google.com; s=arc-20160816; b=jGbfT9GcnIztD0hXUrhP0Sq+IPZ9SteyrIU5XAZTwJzJ6pz5hcWY8doMbbFOKLFarV cJKfDMk8B5edxoEXtkM8/IgX6i1sDFk1x18tgoLRR/sBVAff/XHEN4FQsISvXZwqxMsw LOeuJ8SdYBhsqvPXxqLMgJsSCMmbFXGVjaNVFXmukeCDgbRrBJL8MOC03WMda1wL7NcA 3R3LVKUtmS1m5xQ3ME0uUIynUTrbFcCLrDMPHO5B0bBouOIQbkjJ9rgX6ID368rYAUZb C8wm6eoz/M2fZ/3SuG6STnkmfdDDrHVFhsu2kFaexnd0TnV4/flfmVQXeaacRGRT+Y48 RQ6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=876AH/g0tuUTbiBA2yyLEOyqGbxYhU6MzL7z+qZy1Es=; b=KYY2biAJBD32FTwhkEFvTXdLX8BqwWAToCbpYEVBnd3hrWRNAkmOOpDyPyo1mC99ql kZq/enn5SMSW6W3nEHFMyac+7iMTyj7Y+HpiiaMWJBmlER1ZFegmcQiVoECQRqU1O6Js f2xrNZRoVV62nAiUTUOvcaPIIiBRoXppHdQpXOXcm7v/yD/I8CFETA7Qv/MklJQf2MEK ujZGm9FxDENCm0Qc86lhPPMbd9hZX2OMyrCC5DT8+irBL9md0L2IZGZP15THVSWi6QId HdzZGUEjytavjNMiXbjPNY3X66PxP7qdawDzar58pDbBxKcVBgtfDlNanEBevIZQf9LB /HgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=nrtSGimh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q10si1632260eda.293.2019.10.03.07.47.29; Thu, 03 Oct 2019 07:47:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=nrtSGimh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728897AbfJCOB0 (ORCPT + 99 others); Thu, 3 Oct 2019 10:01:26 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:42743 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727488AbfJCOB0 (ORCPT ); Thu, 3 Oct 2019 10:01:26 -0400 Received: by mail-pl1-f194.google.com with SMTP id e5so1568920pls.9 for ; Thu, 03 Oct 2019 07:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=876AH/g0tuUTbiBA2yyLEOyqGbxYhU6MzL7z+qZy1Es=; b=nrtSGimhbEUSrLHC4xuRBlfgA4KKx/6UC4RgNn/m7LZZT8speP1gcA/3X9nnBoFx+t ILiFjuK+sySg4HdoEME4M8j2CiFYepfSP97WoHkzhZuYedUu6wMu5q2ZNN7I6tpW6Vik zs706DZXTgG2BYmpwnIvEWl663XXqp/Mhe7SM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=876AH/g0tuUTbiBA2yyLEOyqGbxYhU6MzL7z+qZy1Es=; b=sRDEp8uln3EiVjGo5ZDQIwCIMzZ2o5UPfP+USrpHmP6F+cLbOi7UpccBhAt4G02EhY bSvS2STErOEepFl1xBgO9mgJtOQl3xPtNwYBcEW/7cr3SxHZx+2B8Ik+eFEpShvrrtMk fCc8hHErhLMwK72JapD3h/OvBsdT+bfh0+R0xPZZI+syFoDA4lyT/pXl+04K3YSSOWXt Ca3gg+HFZ0LLFiAtIwpU9KFySF8fkxXNlghrl7fMCNR3JnDX3uchoZVZJiYxsnTleEcY iBx80mDV+ewSN39XBIqYxLi2LcMX9ouTXp5Tggg8qtKsgtif1NJSe7JCjTiOENSTKXKG 4mOw== X-Gm-Message-State: APjAAAViHa7C9RcSgPr7sPJcxf1vNXsjY1qjtQ2m6RyrC+/9Q8QYjaw5 M3UWwI+7bl0TpL2q5HPQyZuF6w== X-Received: by 2002:a17:902:968e:: with SMTP id n14mr3320374plp.339.1570111285323; Thu, 03 Oct 2019 07:01:25 -0700 (PDT) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id o185sm5038868pfg.136.2019.10.03.07.01.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2019 07:01:24 -0700 (PDT) Date: Thu, 3 Oct 2019 10:01:23 -0400 From: Joel Fernandes To: "Paul E. McKenney" Cc: Steven Rostedt , David Howells , rcu@vger.kernel.org, linux-kernel@vger.kernel.org, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, Bart Van Assche , Christoph Hellwig , Hannes Reinecke , Johannes Thumshirn , Shane M Seymour , "Martin K . Petersen" Subject: Re: [PATCH tip/core/rcu 1/9] rcu: Upgrade rcu_swap_protected() to rcu_replace() Message-ID: <20191003140123.GF254942@google.com> References: <20191003014310.13262-1-paulmck@kernel.org> <20191003014153.GA13156@paulmck-ThinkPad-P72> <25408.1570091957@warthog.procyon.org.uk> <20191003090850.1e2561b3@gandalf.local.home> <20191003133315.GN2689@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191003133315.GN2689@paulmck-ThinkPad-P72> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 03, 2019 at 06:33:15AM -0700, Paul E. McKenney wrote: > On Thu, Oct 03, 2019 at 09:08:50AM -0400, Steven Rostedt wrote: > > On Thu, 03 Oct 2019 09:39:17 +0100 > > David Howells wrote: > > > > > paulmck@kernel.org wrote: > > > > > > > +#define rcu_replace(rcu_ptr, ptr, c) \ > > > > +({ \ > > > > + typeof(ptr) __tmp = rcu_dereference_protected((rcu_ptr), (c)); \ > > > > + rcu_assign_pointer((rcu_ptr), (ptr)); \ > > > > + __tmp; \ > > > > +}) > > > > > > Does it make sense to actually use xchg() if that's supported by the arch? > > Historically, xchg() has been quite a bit slower than a pair of assignment > statements, in part due to the strong memory ordering guaranteed by > xchg(). Has that changed? If so, then, agreed, it might make sense to > use xchg(). For the kfree_rcu() performance testing I was working on recently, replacing xchg() with a pair of assignment statements in the code being tested provided a great performance increase (on x86). thanks, - Joel