Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp74278ybn; Thu, 3 Oct 2019 01:40:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXKJOE3hwUyl+Q1l58N+a+BgHvyURPE/a4dzmFgScCXZxtetmjCltHLCTpnKKJyuQ/A9o0 X-Received: by 2002:a50:8961:: with SMTP id f30mr8001324edf.144.1570092017165; Thu, 03 Oct 2019 01:40:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570092017; cv=none; d=google.com; s=arc-20160816; b=kkSHvjQS1t+zxpmVDJqGEaYH96/3fhPfnItnyy4fNR4THgGSShZLfkUJ96Dk9aJ15D Z+tqgZN9bPtz3QyWyT3AaUOGQvTorZjRmBtn3/s2Lb3KpzYZT5xgh5nn6BWl8zkw6pxY Pmyx9kBvODWUOhJzOO+B78Q4RS1l4DJOa3ejDzcxhyHqKqefBan8j1faDWLb0ljEUmm4 hdBtqRi6WWWSrOhMx4kr/wPRPVYw+QfzWq2p2s4CxJf820BA06Xpiv7KeBdEfMoFg74N GFMaDWbOitozM4rdMwlELm/V2F5uGv0282wFGUPRFbAptn5KduWEn/GAKZoCjpsdfoYM hUjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization; bh=RrpiPa8haYVlb5P/V/7cCfGGvGtM1FcwSGpLZfbUOjI=; b=ck0B1+yJkV+JJg91gYMu8qSLPXnXzrfQSf8+G5i4l75kXtyNZ2AJgaoCDw3mKqOX12 y0tHsTJgHKex5+21aq+/w9XD/ILT79S5mdSJECAgyRIyCnEYwA/308KmuwtofhoDisKS fDXliCRddQEzcmnARC2Ip4Sn/9WmbeZ1rbXtgAgW2VFFQYha2iufhS2s8OmAsaMZQYR5 /rfWmLu74QUIWcByT/IYvwiCDZmASSERD0yOF/REhYcEzqWkpkZJA+8kjqHsSVq/pAb3 KmqyL+vkGMIAS8i/WlAK4VVKXNCYt6Nxh4vLDeON3dbdFnROFEPdnDojCvldP8Bu5YDl QziQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p28si896483ejn.88.2019.10.03.01.39.41; Thu, 03 Oct 2019 01:40:17 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728746AbfJCIjZ (ORCPT + 99 others); Thu, 3 Oct 2019 04:39:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50896 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726039AbfJCIjZ (ORCPT ); Thu, 3 Oct 2019 04:39:25 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C4E4E1DB0; Thu, 3 Oct 2019 08:39:24 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-125-72.rdu2.redhat.com [10.10.125.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9EB1B5D9DC; Thu, 3 Oct 2019 08:39:18 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20191003014310.13262-1-paulmck@kernel.org> References: <20191003014310.13262-1-paulmck@kernel.org> <20191003014153.GA13156@paulmck-ThinkPad-P72> To: paulmck@kernel.org Cc: dhowells@redhat.com, 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, rostedt@goodmis.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() MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <25407.1570091957.1@warthog.procyon.org.uk> Date: Thu, 03 Oct 2019 09:39:17 +0100 Message-ID: <25408.1570091957@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.71]); Thu, 03 Oct 2019 08:39:25 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? David