Re: [PATCH v5 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-06-29 Thread Pavel Tatashin
> > This is done so nr_consumed_maps does not get out of sync with the > > current pnum. pnum does not equal to nr_consumed_maps, as there are > > may be holes in pnums, but there is one-to-one correlation. > Can this be made more clear in the code? Absolutely. I've done it here: http://lkml.kerne

Re: [PATCH v5 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-06-29 Thread Dave Hansen
On 06/29/2018 11:01 AM, Pavel Tatashin wrote: > Correct: it should be incremented on every iteration of the loop. No matter > if the entries contained valid data or NULLs. So we increment in three places: > > if map_map[] has invalid entry, increment, continue > if usemap_map[] has invalid entry,

Re: [PATCH v5 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-06-29 Thread Pavel Tatashin
On 06/29/2018 01:52 PM, Dave Hansen wrote: > On 06/29/2018 10:48 AM, Pavel Tatashin wrote: >> Here is example: >> Node1: >> map_map[0] -> Struct pages ... >> map_map[1] -> NULL >> Node2: >> map_map[2] -> Struct pages ... >> >> We always want to configure section from Node2 with struct pages from >>

Re: [PATCH v5 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-06-29 Thread Dave Hansen
On 06/29/2018 10:48 AM, Pavel Tatashin wrote: > Here is example: > Node1: > map_map[0] -> Struct pages ... > map_map[1] -> NULL > Node2: > map_map[2] -> Struct pages ... > > We always want to configure section from Node2 with struct pages from > Node2. Even, if there are holes in-between. The same

Re: [PATCH v5 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-06-29 Thread Pavel Tatashin
> > + * increase 'nr_consumed_maps' whether its allocation of memmap > > + * or usemap failed or not, so that after we handle the i-th > > + * memory section, can get memmap and usemap of (i+1)-th section > > + * correctly. */ > > This makes no sense to me. Why are we increment

Re: [PATCH v5 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-06-29 Thread Dave Hansen
> + /* The numner of present sections stored in nr_present_sections ^ "number", please. This comment needs CodingStyle love. > + * are kept the same since mem sections are marked as present in ^ s/are/is/ This sentence is really odd to me. What is t

Re: [PATCH v5 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-06-27 Thread Baoquan He
On 06/27/18 at 11:19pm, Pavel Tatashin wrote: > > Signed-off-by: Baoquan He > > > > Signed-off-by: Baoquan He > > Please remove duplicated signed-off Done. > > > if (!usemap) { > > ms->section_mem_map = 0; > > + nr_consumed_maps++;

Re: [PATCH v5 4/4] mm/sparse: Optimize memmap allocation during sparse_init()

2018-06-27 Thread Pavel Tatashin
> Signed-off-by: Baoquan He > > Signed-off-by: Baoquan He Please remove duplicated signed-off > if (!usemap) { > ms->section_mem_map = 0; > + nr_consumed_maps++; Currently, we do not set ms->section_mem_map to 0 when fail to allocat