On Fri, Mar 29, 2019 at 4:54 PM Vlastimil Babka <vbabka@xxxxxxx> wrote: > > On 3/29/19 9:48 AM, Yafang Shao wrote: > > On Fri, Mar 29, 2019 at 4:45 PM Vlastimil Babka <vbabka@xxxxxxx> wrote: > >> > >> On 3/29/19 9:36 AM, Yafang Shao wrote: > >>> direct_compaction is not initialized for kcompactd or manually triggered > >>> compaction (via /proc or /sys). > >> > >> It doesn't need to, this style of initialization does guarantee that any > >> field not explicitly mentioned is initialized to 0/NULL/false... and > >> this pattern is used all over the kernel. > >> > > > > Hmm. > > You mean the gcc will set the local variable to 0 ? > > Not local variable, but fields omitted in this "designated initializers" > scenario. > > > Are there any reference to this behavior ? > > https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html > > "Omitted fields are implicitly initialized the same as for objects that > have static storage duration. " > and static objects are implicitly 0 > Got it! Many thanks for your help. Thanks Yafang