Re: [PATCH v2 1/7] sparc/srmmu: Remove on-stack cpumask var

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
> ---
>  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;
}

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@xxxxxxxxxxxx>

	Sam




[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux