Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp467575ybn; Thu, 3 Oct 2019 07:39:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzta1N1LpgOQyRYlptF/ZSiF8aTbFeONwhPWCUwMmIVjPi4pkx4vsAx7SYqfndBoNDoAEIK X-Received: by 2002:a50:9e0a:: with SMTP id z10mr10015622ede.202.1570113547658; Thu, 03 Oct 2019 07:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570113547; cv=none; d=google.com; s=arc-20160816; b=e+3f/Oa5l4nJcT9DEYuiENX7pZjYnvmDYcEn8meUvUKlHtwBXKkHjX83dEzbP6TDtv NBej6K3fK35YT/5weAIsVSPv15M/2vHvhUq4nNMFvBsD4/doE7pB4NxaNBZ8La2xrSD/ jqQ0B6bBUoBs1j8792C+fkH09ZQrblEUehZVy18bzjOSc0PyivINKOrXUfh+n2+5rRfC VOTWLxTl+fCl+XZQY6fOLMMXB/NUWLKw3IixrZD/131csqIvI9eetKyrRqt/kC8yYRph FH0CBoSE0WZXngE9ZsPeGgSBG4uH5Bhu0oxnXyk05lBuDRanSR19hXHb61WD9I/y629M Xi4Q== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=YotXnS8byFo6PJ61Rrbbl1VvaFN4zgLK151RhN7K4PE=; b=0+M+2M3ykNeqgIgSUinxdaPdBikWdSRUjqMKunUrys+BAZ7Wj5GKphsDej4VNyTV/0 2aDETtYLwauqzYHW2dk5FvfZrgcbPZuvXB8WTYpbo7TNdIjKRwitJRAEbV1p8tdhVl4E BnYzkrBEFRYT9ns8GDDP5uTHPx0uamjZC/WhTxtWepBRnv8dJQwl3NvNGKZtBA4FwaRQ OocHzafRZCOzNkBmw38q+t9IPviBKKWICrePDEOQpRFgNgob/Fe3zeHFZrWCtOB2XWhb HhDmut7AD3lFWD10YzwQU6IVM4IE1wiCjPE/XStSj4gtYmBECx++aUhh7kWS2J1zrdFi E9Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PKzGIIiN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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.38.42; Thu, 03 Oct 2019 07:39:07 -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=@kernel.org header.s=default header.b=PKzGIIiN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730427AbfJCNdS (ORCPT + 99 others); Thu, 3 Oct 2019 09:33:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:50296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729919AbfJCNdR (ORCPT ); Thu, 3 Oct 2019 09:33:17 -0400 Received: from paulmck-ThinkPad-P72 (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9CE8820700; Thu, 3 Oct 2019 13:33:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570109596; bh=x0CnYCCGf6FnkdtfGaZWMy93bevZ9ZOXNmc//+cTm4I=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=PKzGIIiNFbgxn1c/bqb5oeow07qPFQ6UU4mPYcFQJ90WoKzMR51u1ARJauNGb38ih iQc+N84WhQTP+xVgsxiJjNArI/Gnr5Bwp9dnZHWBpSIYBvhHuO2eYN2hvAA2NmjyKr XzVfSYNfdRXnWksL3jodJgDNZW9RqJHjEb9ItpsI= Date: Thu, 3 Oct 2019 06:33:15 -0700 From: "Paul E. McKenney" To: Steven Rostedt Cc: 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, joel@joelfernandes.org, 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: <20191003133315.GN2689@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20191003014310.13262-1-paulmck@kernel.org> <20191003014153.GA13156@paulmck-ThinkPad-P72> <25408.1570091957@warthog.procyon.org.uk> <20191003090850.1e2561b3@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191003090850.1e2561b3@gandalf.local.home> User-Agent: Mutt/1.9.4 (2018-02-28) 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 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(). > Hmm, is there really any arch that doesn't support xchg()? It would be > very hard to do any kind of atomic operations without it. > > cmpxchg() is the one that I understand is optional by the arch. To your point, even the old Sequent Symmetry platforms supported xchg() back in the late 1980s and early 1990s, but only the later versions (with 80486 and later) supported cmpxchg(). Thanx, Paul