Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp470605ybn; Thu, 3 Oct 2019 07:41:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfQQ9Ncvy+knilVxQv0Y2xROnBLdL2utlwCVSFjcGPekMS9DjoS6BJR+nYEcQdIDTRYpPd X-Received: by 2002:a50:b7ed:: with SMTP id i42mr9649431ede.52.1570113703604; Thu, 03 Oct 2019 07:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570113703; cv=none; d=google.com; s=arc-20160816; b=jgC7HTylrOhwkFAwqcA9KoKPpXfxwTFsSk5XvfrI1/T5f3Km5LOQXWSelhLMQscUzw rfQSXIerb51GYbj4nLmbRU609M+aJ1LPWFVJM6RayKYFvbPuS4ih7vORN/FqkkVxOlHw HQY8mwH0K7CKS2eVaIBZDVzQWWZhJF9MsyMWvRwwcKfLNMNWTcSNn5qZNjZHKd2o0ru+ nwO7S2kSS6sUJ9SKX97mlwpNbnFqt+FjTzL/rCSUH8b+mrxKqe2RkxAUhYWgN0XokDPT Ju/AmyeLRn1F7ayuPEcbdNTmMGXnCJsWV8oT4uhGwTQiSvRN0mZj9+uKKk9HuBJnd7Mm FD1g== 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=Z4Fbmkp6VSKxSOTmoTLoE7iXbtqotSgieIcrdQiNoGU=; b=uLqEY/GeMwtpe2VxzPJ8/QrJHRdPpE7WEFMQEXAuPhBN9yDA1/pVL2qaTvHL1V2Qfx 9uhYxhAAjpjekRC7WFu5d0aKePc1kq1KrFa2aPUivSacDyrKPjq30YMBQrOvmQoXdBFU S4H3ERDMrP6ertjwkBIFpRO4My6Ae2pKShKJ/jHHpPzgaJWF755UgCAm+x2rqQVunFFt aqq3KfV+DfL95Riv7QjlD53ifjG5dP7xa3s7zHmNZnAmCTjwirCxQhD/SWNECwCCcSXp 7jYhsdNczX70/ah2sbVOP/+OQ2VYubkhi5ipnHN9K7jBBRc0hVui7Asv37Jb2myueJ0j 0piw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qUV1crH7; 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 n17si1480696edo.143.2019.10.03.07.41.18; Thu, 03 Oct 2019 07:41:43 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qUV1crH7; 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 S1730501AbfJCNmD (ORCPT + 99 others); Thu, 3 Oct 2019 09:42:03 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34126 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729655AbfJCNmD (ORCPT ); Thu, 3 Oct 2019 09:42:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Z4Fbmkp6VSKxSOTmoTLoE7iXbtqotSgieIcrdQiNoGU=; b=qUV1crH7ygkqKhnHi2IVWd+st lXJ7A/lJUBFz85JZLlVJDEsvt/Do5pDrSI/v/MZGzctjy/o+iO6mh7kPrEchwnC7N7ozweNvafw1K 8Cah++IsdSrEEb4s0fueywltkwTz5WYtLFdGqLPdGIaqx5CvYiStBUK7T2K+BDwdBKHSjvxEkK0yo mVDv871kS9PrS7lOxVgzS6MFxvd/F2fsII/Z1vT0yPIND0VJG0f3DlOr3hMkrh279beQQjmNhcneR hSpthD0Hz0HZzmpDKsbuU8ZVsBDtPPFhw7TpklhppdFTcIwaM9v0uCw2ED99k57cdCrgjJXqGuKf+ FmsVIEkpg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.2 #3 (Red Hat Linux)) id 1iG1MN-0000Ba-AD; Thu, 03 Oct 2019 13:41:35 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id D981D304B4C; Thu, 3 Oct 2019 15:40:42 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0B8B5201EFE03; Thu, 3 Oct 2019 15:41:32 +0200 (CEST) Date: Thu, 3 Oct 2019 15:41:31 +0200 From: Peter Zijlstra 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, 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: <20191003134131.GS4536@hirez.programming.kicks-ass.net> 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(). Nope, still the case. xchg() is an atomic op with full ordering.