Thread (22 messages) 22 messages, 4 authors, 2018-06-29

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

From: Pavel Tatashin <hidden>
Date: 2018-06-29 17:48:49
Also in: lkml

quoted
+      * 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 incrementing 'nr_consumed_maps'
when we do not consume one?

You say that we increment it so that things will work, but not how or
why it makes things work.  I'm confused.
Hi Dave,

nr_consumed_maps is a local counter. map_map contains struct pages for
each section. In order to assign them to correct sections this local
counter must be incremented even when some parts of map_map are empty.

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 with usemap.

Pavel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help