Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp5023799ybg; Mon, 21 Oct 2019 19:15:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVmCXEsOjDKhclbJaSJBIt6riPjt5YfWdpEr+lUqi1DqM1Wv02GSveKqnMp4KAvG251kb8 X-Received: by 2002:a17:906:2d49:: with SMTP id e9mr24960413eji.240.1571710556856; Mon, 21 Oct 2019 19:15:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571710556; cv=none; d=google.com; s=arc-20160816; b=knz6BXJ3Ne3nBAu0TT+83oF9ICrFss2gsoDcTVGa+fq/p0EAxYAqa/V8lrppert8EK 2ZvTp35zUmMxYzhOqmmjdBIUFB5TakcndQo4Mn9q3ZOCADXMkwnYEe6u40EJsLUXyT1D kVzI5yehNJ96klmJwdd83Mri+b9kn6fsMEa8PftBo2nUMTsTy2qS44HdJh4ORVT3jxW2 wZ4zcUNXY0MkaOgvDXwsL2MzjLgR+gqaNLRTnN6o5kseB64xrQvBXWJZOlcuMA6Dq3NS 0YWDnixaGCp6YTYnWMRThJ97kjLcuYN254YY80Lbe0N8BFBZQnKrQ5zjVMXBoVpYrp9s hStg== 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=ThM/4cWrcb7FXDVkW3M+I/rAbKfVSkqb/g20Ij4N4gI=; b=llxN6/07U9Sii75nPXl3XvI9r/4nyPLqjLnACAz8GO2Kv8Qp/6UAltUjZN5SUW2yX+ pHWMdCMUYq4EicLJ1TMbPrgNlB0HR7I2fhB/XpG/Kr8Y9LBgzXmWRwOW6a6MlqHSfYUS 8Y+n2p3G373jn92Vc6J11mu5nfxYjTw2f7swdmRxOSqkNWwH5goL+1FF2lYoBh+yJW8y y5jay51AIEsenxecweLxkE4qNFjakAHuLsk8+vK+5CG0VXv0oyFVSG0glfamvFTANaF9 HwZXD1Uoior0yx4cNz35FVagdfUb/so6AShgjDKtuC4YMYNrylFuPuUtAkPi/5qDnPUy sNMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=W2+pqJsX; 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 ay2si10359845edb.343.2019.10.21.19.15.33; Mon, 21 Oct 2019 19:15:56 -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=W2+pqJsX; 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 S1730821AbfJVCNK (ORCPT + 99 others); Mon, 21 Oct 2019 22:13:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:42594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727264AbfJVCNK (ORCPT ); Mon, 21 Oct 2019 22:13:10 -0400 Received: from paulmck-ThinkPad-P72 (cpe-67-241-73-101.twcny.res.rr.com [67.241.73.101]) (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 873D12086D; Tue, 22 Oct 2019 02:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571710389; bh=S/2WtQMt9L/0ZoLF2YR0k3YeJsSzQfW7/ml8EXtJZvQ=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=W2+pqJsXZVCDf8qWvoR27cJI/6f5uG2gCB5k8Ghad9Zr7D2VIHYSdll/wRwZqRLFd UbKo85vILq3YxvjNwmzn0pBvbtBvPflDFTDPKcElEKh/h2kH4hnuXnZjumRLMbQxpl OH6GT+HydvwSq7LrueUKv9geSOaxXaQGAo4OLsG4= Date: Mon, 21 Oct 2019 19:13:06 -0700 From: "Paul E. McKenney" To: Ingo Molnar Cc: Linus Torvalds , Micah Morton , Jann Horn , Bart Van Assche , Linux Kernel Mailing List , linux-security-module Subject: Re: [GIT PULL] SafeSetID LSM changes for 5.4 Message-ID: <20191022021306.GB2479@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20190923233038.GE7828@paulmck-ThinkPad-P72> <20191021065811.GA17098@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191021065811.GA17098@gmail.com> 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 Mon, Oct 21, 2019 at 08:58:11AM +0200, Ingo Molnar wrote: > > * Paul E. McKenney wrote: > > > --- a/include/linux/rcupdate.h > > +++ b/include/linux/rcupdate.h > > @@ -383,20 +383,22 @@ do { \ > > } while (0) > > > > /** > > - * rcu_swap_protected() - swap an RCU and a regular pointer > > - * @rcu_ptr: RCU pointer > > + * rcu_replace() - replace an RCU pointer, returning its old value > > + * @rcu_ptr: RCU pointer, whose old value is returned > > * @ptr: regular pointer > > - * @c: the conditions under which the dereference will take place > > + * @c: the lockdep conditions under which the dereference will take place > > * > > - * Perform swap(@rcu_ptr, @ptr) where @rcu_ptr is an RCU-annotated pointer and > > - * @c is the argument that is passed to the rcu_dereference_protected() call > > - * used to read that pointer. > > + * Perform a replacement, where @rcu_ptr is an RCU-annotated > > + * pointer and @c is the lockdep argument that is passed to the > > + * rcu_dereference_protected() call used to read that pointer. The old > > + * value of @rcu_ptr is returned, and @rcu_ptr is set to @ptr. > > */ > > -#define rcu_swap_protected(rcu_ptr, ptr, c) do { \ > > +#define rcu_replace(rcu_ptr, ptr, c) \ > > +({ \ > > typeof(ptr) __tmp = rcu_dereference_protected((rcu_ptr), (c)); \ > > rcu_assign_pointer((rcu_ptr), (ptr)); \ > > - (ptr) = __tmp; \ > > -} while (0) > > + __tmp; \ > > +}) > > One small suggestion, would it make sense to name it "rcu_replace_pointer()"? > > This would make it fit into the pointer handling family of RCU functions: > rcu_assign_pointer(), rcu_access_pointer(), RCU_INIT_POINTER() et al? Easy enough to make the change. I will do that tomorrow and test over the following night. > rcu_swap() would also look a bit weird if used in MM code. ;-) How much RCU swap should we configure on this system? About same amount as reader-writer swap! ;-) Thanx, Paul