Re: [PATCH 1/7] mm: allocate mm_cpumask dynamically based on nr_cpu_ids
From: Rik van Riel
Date: Sat Jul 07 2018 - 17:25:15 EST
I. On Sat, 2018-07-07 at 10:23 +0200, Mike Galbraith wrote:
> On Fri, 2018-07-06 at 17:56 -0400, Rik van Riel wrote:
> > The mm_struct always contains a cpumask bitmap, regardless of
> > CONFIG_CPUMASK_OFFSTACK. That means the first step can be to
> > simplify things, and simply have one bitmask at the end of the
> > mm_struct for the mm_cpumask.
>
> Otherwise virgin master.today grumbles.
>
> CC kernel/bounds.s
> UPD include/generated/timeconst.h
> UPD include/generated/bounds.h
> CC arch/x86/kernel/asm-offsets.s
> UPD include/generated/asm-offsets.h
> CALL scripts/checksyscalls.sh
> CHK include/generated/compile.h
> HOSTCC usr/gen_init_cpio
> UPD include/generated/compile.h
> CC init/main.o
> In file included from ./include/linux/cpumask.h:12:0,
> from ./arch/x86/include/asm/cpumask.h:5,
> from ./arch/x86/include/asm/msr.h:11,
> from ./arch/x86/include/asm/processor.h:21,
> from ./arch/x86/include/asm/cpufeature.h:5,
> from ./arch/x86/include/asm/thread_info.h:53,
> from ./include/linux/thread_info.h:38,
> from ./arch/x86/include/asm/preempt.h:7,
> from ./include/linux/preempt.h:81,
> from ./include/linux/spinlock.h:51,
> from ./include/linux/seqlock.h:36,
> from ./include/linux/time.h:6,
> from ./include/linux/stat.h:19,
> from ./include/linux/module.h:10,
> from init/main.c:16:
> In function âbitmap_zeroâ,
> inlined from âcpumask_clearâ at ./include/linux/cpumask.h:378:2,
> inlined from âmm_init_cpumaskâ at
> ./include/linux/mm_types.h:504:2,
> inlined from âstart_kernelâ at init/main.c:560:2:
> ./include/linux/bitmap.h:208:3: warning: âmemsetâ writing 64 bytes
> into a region of size 0 overflows the destination [-Wstringop-
> overflow=]
> memset(dst, 0, len);
> ^~~~~~~~~~~~~~~~~~~
I don't understand this one.
Inside init_mm we have this line:
.cpu_bitmap = { [BITS_TO_LONGS(NR_CPUS)] = 0},
which is the way the documentation suggests statically
allocated variable size arrays should be allocated
and initialized.
How does that result in a memset of the same size,
on the same array, to throw an error like above?
What am I doing wrong?
--
All Rights Reversed.Attachment:
signature.asc
Description: This is a digitally signed message part