lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8932691918B6B5F5+ZiX5tIZF9bZKbiBp@centos8>
Date: Mon, 22 Apr 2024 13:46:28 +0800
From: Dawei Li <dawei.li@...ngroup.cn>
To: Sam Ravnborg <sam@...nborg.org>
Cc: davem@...emloft.net, andreas@...sler.com, sparclinux@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/7] sparc/srmmu: Remove on-stack cpumask var

Hi Sam,

Thanks for review.

On Sat, Apr 20, 2024 at 09:58:46AM +0200, Sam Ravnborg wrote:
> Hi Dawei,
> On Sat, Apr 20, 2024 at 01:15:41PM +0800, Dawei Li wrote:
> > In general it's preferable to avoid placing cpumasks on the stack, as
> > for large values of NR_CPUS these can consume significant amounts of
> > stack space and make stack overflows more likely.
> > 
> > Use cpumask_any_but() to avoid the need for a temporary cpumask on
> > the stack.
> 
> Another good argument for this patch is the simplification of the code.
> 
> > 
> > Signed-off-by: Dawei Li <dawei.li@...ngroup.cn>
> > ---
> >  arch/sparc/mm/srmmu.c | 40 ++++++++++++----------------------------
> >  1 file changed, 12 insertions(+), 28 deletions(-)
> > 
> > diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
> > index 852085ada368..86fd20c878ae 100644
> > --- a/arch/sparc/mm/srmmu.c
> > +++ b/arch/sparc/mm/srmmu.c
> > @@ -1653,13 +1653,15 @@ static void smp_flush_tlb_all(void)
> >  	local_ops->tlb_all();
> >  }
> >  
> > +static bool cpumask_any_but_current(struct mm_struct *mm)
> > +{
> > +	return cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids;
> > +}
> 
> This helper is not a cpumask helper - the name should reflect what it is
> used for.
> 
> Something like:
> static bool any_other_mm_cpus(struct mm_struct *mm)
> {
> 	return cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids;
> }

Acked. I will rename the helper as you suggested.

> 
> The implementation is fine - it is only the naming that should be
> improve.
> With this change (or a better name):
> Reviewed-by: Sam Ravnborg <sam@...nborg.org>
> 
> 	Sam

Thanks,

    Dawei
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ