From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754483AbdKJXvu (ORCPT ); Fri, 10 Nov 2017 18:51:50 -0500 Received: from mx2.suse.de ([195.135.220.15]:43104 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754022AbdKJXvt (ORCPT ); Fri, 10 Nov 2017 18:51:49 -0500 Date: Sat, 11 Nov 2017 00:51:48 +0100 From: "Luis R. Rodriguez" To: Christophe JAILLET , akpm@linux-foundation.org Cc: mcgrof@kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] umh: Optimize 'proc_cap_handler()' Message-ID: <20171110235148.GW22894@wotan.suse.de> References: <20171020193331.7233-1-christophe.jaillet@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171020193331.7233-1-christophe.jaillet@wanadoo.fr> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 20, 2017 at 09:33:31PM +0200, Christophe JAILLET wrote: > If 'write' is 0, we can avoid a call to spin_lock/spin_unlock. > > Signed-off-by: Christophe JAILLET Thanks for the patch! Acked-by: Luis R. Rodriguez I'll bounce a copy to Andrew for integration next. Luis > --- > kernel/umh.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/umh.c b/kernel/umh.c > index 6ff9905250ff..18e5fa4b0e71 100644 > --- a/kernel/umh.c > +++ b/kernel/umh.c > @@ -537,14 +537,14 @@ static int proc_cap_handler(struct ctl_table *table, int write, > /* > * Drop everything not in the new_cap (but don't add things) > */ > - spin_lock(&umh_sysctl_lock); > if (write) { > + spin_lock(&umh_sysctl_lock); > if (table->data == CAP_BSET) > usermodehelper_bset = cap_intersect(usermodehelper_bset, new_cap); > if (table->data == CAP_PI) > usermodehelper_inheritable = cap_intersect(usermodehelper_inheritable, new_cap); > + spin_unlock(&umh_sysctl_lock); > } > - spin_unlock(&umh_sysctl_lock); > > return 0; > } > -- > 2.14.1 > > -- Luis Rodriguez, SUSE LINUX GmbH Maxfeldstrasse 5; D-90409 Nuernberg From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Luis R. Rodriguez" Date: Fri, 10 Nov 2017 23:51:48 +0000 Subject: Re: [PATCH] umh: Optimize 'proc_cap_handler()' Message-Id: <20171110235148.GW22894@wotan.suse.de> List-Id: References: <20171020193331.7233-1-christophe.jaillet@wanadoo.fr> In-Reply-To: <20171020193331.7233-1-christophe.jaillet@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Christophe JAILLET , akpm@linux-foundation.org Cc: mcgrof@kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org On Fri, Oct 20, 2017 at 09:33:31PM +0200, Christophe JAILLET wrote: > If 'write' is 0, we can avoid a call to spin_lock/spin_unlock. > > Signed-off-by: Christophe JAILLET Thanks for the patch! Acked-by: Luis R. Rodriguez I'll bounce a copy to Andrew for integration next. Luis > --- > kernel/umh.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/umh.c b/kernel/umh.c > index 6ff9905250ff..18e5fa4b0e71 100644 > --- a/kernel/umh.c > +++ b/kernel/umh.c > @@ -537,14 +537,14 @@ static int proc_cap_handler(struct ctl_table *table, int write, > /* > * Drop everything not in the new_cap (but don't add things) > */ > - spin_lock(&umh_sysctl_lock); > if (write) { > + spin_lock(&umh_sysctl_lock); > if (table->data = CAP_BSET) > usermodehelper_bset = cap_intersect(usermodehelper_bset, new_cap); > if (table->data = CAP_PI) > usermodehelper_inheritable = cap_intersect(usermodehelper_inheritable, new_cap); > + spin_unlock(&umh_sysctl_lock); > } > - spin_unlock(&umh_sysctl_lock); > > return 0; > } > -- > 2.14.1 > > -- Luis Rodriguez, SUSE LINUX GmbH Maxfeldstrasse 5; D-90409 Nuernberg