Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp477390ybn; Thu, 3 Oct 2019 07:47:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzyXOxsdF96i4aSvtTMsJGoqFhjXRalUf8PhR7eEjEmpBo8avc2jCSOMWAezR7ldwR3c088 X-Received: by 2002:a17:906:3083:: with SMTP id 3mr7836977ejv.259.1570114054163; Thu, 03 Oct 2019 07:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570114054; cv=none; d=google.com; s=arc-20160816; b=tgDtNArg1M93THEVZx+o8+ef8CerD5LfdT6/L/2AK6bBCF/uf6225a/Q4r9y5yHX7N 0SV8Q6QWp1q9pkctmmWgTbUXTN9G5dC8aC4rY0PhzpPghnL8IvzvtVu5NbIT9OCDMhfZ w46HLlKMx71Peu05nOJAK5VSUaLvGIRv3WN51leruouxyGsnsfEZKlspklzdlfamJ+de UnuiAv+R0fB726ebXbq/IlKEEt3VEs2wm/AJ7G/NR9B2S6yn/YU5+7D2O0ylAbCt9i7q u7rW30d9uDAUihqMKkFcliNeUYdftCK3jtVN3FWvjHmaSvVgvCt4f2KFYjWOUKfuv9ZK jAxA== 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=nxdIauF8OlTkSC8Hw3mVzLfNStZn97R534Fe0k2MRcE=; b=c/K3eIUC5iysYr/9i5WA7YD2gVeqGIfO9QiN1jVxMOOXooOGuGMZpf3GKUJuETl58W TDEhaLBKzqN7L1rycd8+sYwcmY9scC9scfFv12z+GyAZj0XC2L+CxKOoLrEAidZ+IlCR SOU+61x3XDU191Fci3cBVTIPJnPQAQ2KIKM43bmAXH99yqJhYKnZK9lgAI3fRp7I++Pv jl6bVpRxvCKJFJ7M9jtZKY3lTwRWba0UCZ8YP6ULNVzA75O2ECIhWTeRKmNZauQP2e+U cO5kUrpocU84qbF7iIaeuq5HcH+mW2Q1uWPzz5Pa/eUWuwYdwR6CSzCkvtePm2biksw/ KLnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LA26TD21; 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 p14si1418291ejn.192.2019.10.03.07.47.09; Thu, 03 Oct 2019 07:47:34 -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=LA26TD21; 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 S1729691AbfJCN6G (ORCPT + 99 others); Thu, 3 Oct 2019 09:58:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:59618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725907AbfJCN6G (ORCPT ); Thu, 3 Oct 2019 09:58:06 -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 7A73020865; Thu, 3 Oct 2019 13:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570111085; bh=l1Q8lHXuoN3TJqBllSFbScMN9RwGTZhbVho5omx4P/0=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=LA26TD21ueBZ3XwCFg+wA8fztaYSGZU2is/9B+0cZxU6cnA16Zl9z4pmd7gqO+izz DN/tmGHUX/6DzwTPV8RIYhIovfAkcfZi2odqadsQ5vFgrFF1J8o2LNyklJ3IRAm3zd gBjEfEE30Gd72478SVO2c+M6l9HuU6cW0TjnjOcE= Date: Thu, 3 Oct 2019 06:58:04 -0700 From: "Paul E. McKenney" To: Peter Zijlstra 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, 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: <20191003135804.GU2689@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> <20191003133315.GN2689@paulmck-ThinkPad-P72> <20191003134131.GS4536@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191003134131.GS4536@hirez.programming.kicks-ass.net> 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 03:41:31PM +0200, Peter Zijlstra wrote: > 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(). > > Nope, still the case. xchg() is an atomic op with full ordering. OK, let's stick with the pair of assignments, then. ;-) Thanx, Paul