From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758917AbcIWJdp (ORCPT ); Fri, 23 Sep 2016 05:33:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39164 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758414AbcIWJdm (ORCPT ); Fri, 23 Sep 2016 05:33:42 -0400 Date: Fri, 23 Sep 2016 11:32:42 +0200 From: Oleg Nesterov To: Waiman Long Cc: Andrew Morton , Ingo Molnar , Thomas Gleixner , Stas Sergeev , linux-kernel@vger.kernel.org, Scott J Norton , Douglas Hatch Subject: Re: [PATCH] signals: Avoid unnecessary taking of sighand->siglock Message-ID: <20160923093241.GA13792@redhat.com> References: <1474568705-40114-1-git-send-email-Waiman.Long@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1474568705-40114-1-git-send-email-Waiman.Long@hpe.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 23 Sep 2016 09:33:42 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/22, Waiman Long wrote: > > This patch is currently only active for 64-bit architectures. Why? > --- a/kernel/signal.c > +++ b/kernel/signal.c > @@ -2485,6 +2485,16 @@ void __set_current_blocked(const sigset_t *newset) > { > struct task_struct *tsk = current; > > + /* > + * In case the signal mask hasn't changed, we won't need to take > + * the lock. As the current blocked mask can be modified by other > + * CPUs, No, nobody else should modify current->blocked. Yes, we need to cleanup the usage of force_sig_info(), and probably remove the "struct task_struct *t" argument. > we need to do an atomic read without lock. In other words, > + * this check will only be done on 64-bit systems. > + */ > +#if _NSIG_WORDS == 1 > + if (READ_ONCE(tsk->blocked.sig[0]) == newset->sig[0]) > + return; > +#endif OK, agreed, but this should not depend on _NSIG_WORDS == 1 and READ_ONCE() looks confusing. It seems you need to add the new helper into include/linux/signal.h. Oleg.