Re: [PATCH v3 1/2] mm/sparse: add sparse_init_nid()
From: Baoquan He
Date: Sun Jul 01 2018 - 23:14:28 EST
On 07/01/18 at 11:03pm, Pavel Tatashin wrote:
> > Ah, yes, I misunderstood it, sorry for that.
> >
> > Then I have only one concern, for vmemmap case, if one section doesn't
> > succeed to populate its memmap, do we need to skip all the remaining
> > sections in that node?
>
> Yes, in sparse_populate_node() we have the following:
>
> 294 for (pnum = pnum_begin; map_index < map_count; pnum++) {
> 295 if (!present_section_nr(pnum))
> 296 continue;
> 297 if (!sparse_mem_map_populate(pnum, nid, NULL))
> 298 break;
>
> So, on the first failure, we even stop trying to populate other
> sections. No more memory to do so.
This is the thing I worry about. In old sparse_mem_maps_populate_node()
you can see, when not present or failed to populate, just continue. This
is the main difference between yours and the old code. The key logic is
changed here.
void __init sparse_mem_maps_populate_node(struct page **map_map,
unsigned long pnum_begin,
unsigned long pnum_end,
unsigned long map_count, int nodeid)
{
...
for (pnum = pnum_begin; pnum < pnum_end; pnum++) {
struct mem_section *ms;
if (!present_section_nr(pnum))
continue;
map_map[pnum] = sparse_mem_map_populate(pnum, nodeid, NULL);
if (map_map[pnum])
continue;
ms = __nr_to_section(pnum);
pr_err("%s: sparsemem memory map backing failed some memory will not be available\n",
__func__);
ms->section_mem_map = 0;
}
...
}