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: <cc686b67-73f4-606b-9df3-3fe63d85195a@linux.intel.com>
Date:   Fri, 22 Jun 2018 08:10:09 -0700
From:   Dave Hansen <dave.hansen@...ux.intel.com>
To:     Rik van Riel <riel@...riel.com>, linux-kernel@...r.kernel.org
Cc:     luto@...nel.org, mingo@...nel.org, tglx@...utronix.de,
        efault@....de, songliubraving@...com, kernel-team@...com
Subject: Re: [PATCH 1/7] mm: allocate mm_cpumask dynamically based on
 nr_cpu_ids

On 06/20/2018 12:56 PM, Rik van Riel wrote:
>  	/*
> -	 * FIXME! The "sizeof(struct mm_struct)" currently includes the
> -	 * whole struct cpumask for the OFFSTACK case. We could change
> -	 * this to *only* allocate as much of it as required by the
> -	 * maximum number of CPU's we can ever have.  The cpumask_allocation
> -	 * is at the end of the structure, exactly for that reason.
> +	 * The mm_cpumask is located at the end of mm_struct, and is
> +	 * dynamically sized based on nr_cpu_ids.
>  	 */
> +	mm_size = sizeof(struct mm_struct) + cpumask_size();
> +
>  	mm_cachep = kmem_cache_create_usercopy("mm_struct",
> -			sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN,
> +			mm_size, ARCH_MIN_MMSTRUCT_ALIGN,

Could you add a bit to that comment, like "dynamically sized based on
nr_cpu_ids" ... which is sized based on the number of possible CPUs.

I found myself wondering how that interacts with hotplug.

t mm_struct, saved_auxv),
> diff --git a/mm/init-mm.c b/mm/init-mm.c
> index f94d5d15ebc0..20fe222fe4c0 100644
> --- a/mm/init-mm.c
> +++ b/mm/init-mm.c
> @@ -15,6 +15,15 @@
>  #define INIT_MM_CONTEXT(name)
>  #endif
>  
> +/*
> + * For dynamically allocated mm_structs, there is a dynamically sized cpumask
> + * at the end of the structure, the size of which depends on nr_cpu_ids. That...

Similar nit.  Instead of calling out the variable alone, could we just
say what it means logically and then reference the variable?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ