linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/init-mm.c: use CPU_BITS_NONE to initialize .cpu_bitmap
@ 2019-08-22  7:52 Rasmus Villemoes
  2019-08-22 13:26 ` Mike Rapoport
  0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Villemoes @ 2019-08-22  7:52 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Rasmus Villemoes, linux-mm, linux-kernel

init_mm is sizeof(long) larger than it needs to be. Use the
CPU_BITS_NONE macro meant for this, which will initialize just the
indices 0...(BITS_TO_LONGS(NR_CPUS)-1) and hence make the array size
actually BITS_TO_LONGS(NR_CPUS).

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 mm/init-mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/init-mm.c b/mm/init-mm.c
index a787a319211e..fb1e15028ef0 100644
--- a/mm/init-mm.c
+++ b/mm/init-mm.c
@@ -35,6 +35,6 @@ struct mm_struct init_mm = {
 	.arg_lock	=  __SPIN_LOCK_UNLOCKED(init_mm.arg_lock),
 	.mmlist		= LIST_HEAD_INIT(init_mm.mmlist),
 	.user_ns	= &init_user_ns,
-	.cpu_bitmap	= { [BITS_TO_LONGS(NR_CPUS)] = 0},
+	.cpu_bitmap	= CPU_BITS_NONE,
 	INIT_MM_CONTEXT(init_mm)
 };
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/init-mm.c: use CPU_BITS_NONE to initialize .cpu_bitmap
  2019-08-22  7:52 [PATCH] mm/init-mm.c: use CPU_BITS_NONE to initialize .cpu_bitmap Rasmus Villemoes
@ 2019-08-22 13:26 ` Mike Rapoport
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Rapoport @ 2019-08-22 13:26 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: Andrew Morton, linux-mm, linux-kernel

Hi,

On Thu, Aug 22, 2019 at 09:52:07AM +0200, Rasmus Villemoes wrote:
> init_mm is sizeof(long) larger than it needs to be. Use the
> CPU_BITS_NONE macro meant for this, which will initialize just the
> indices 0...(BITS_TO_LONGS(NR_CPUS)-1) and hence make the array size
> actually BITS_TO_LONGS(NR_CPUS).

I've sent a similar patch [1] a week or so ago, it's in -mm tree.

[1] https://lore.kernel.org/linux-mm/1565703815-8584-1-git-send-email-rppt@linux.ibm.com/
 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  mm/init-mm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/init-mm.c b/mm/init-mm.c
> index a787a319211e..fb1e15028ef0 100644
> --- a/mm/init-mm.c
> +++ b/mm/init-mm.c
> @@ -35,6 +35,6 @@ struct mm_struct init_mm = {
>  	.arg_lock	=  __SPIN_LOCK_UNLOCKED(init_mm.arg_lock),
>  	.mmlist		= LIST_HEAD_INIT(init_mm.mmlist),
>  	.user_ns	= &init_user_ns,
> -	.cpu_bitmap	= { [BITS_TO_LONGS(NR_CPUS)] = 0},
> +	.cpu_bitmap	= CPU_BITS_NONE,
>  	INIT_MM_CONTEXT(init_mm)
>  };
> -- 
> 2.20.1
> 
> 

-- 
Sincerely yours,
Mike.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-22 13:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-22  7:52 [PATCH] mm/init-mm.c: use CPU_BITS_NONE to initialize .cpu_bitmap Rasmus Villemoes
2019-08-22 13:26 ` Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).