To initialize its "sparse" memory allocate Linux validates one of its structs have a power-of-2 size, allocates a memsection if necessary & flags each (both via a helper, & more in turn) updating numerous tables while validating the structure of heap-space, validates (via another helper) that there's a bitmask we can use, iterates over sections (via a helper & more in turn) carefully locating the 1st valid one, dereferences the section's "NR" & bit-extracts a "NID" property, ...
1/2?
... chooses a pageblock order (via a caching helper), iterates over the present sections (indirectly reusing some of those helpers), defers to another routine to init NIDs, & on x86 outputs some debug logs.
For each present section Linux likewise retrieves its NID, skips ones which match `nid_begin`, likewise inits that nid, & updates some locals including `nid_begin`.
1.5/1.5 Fin for today! Tomorrow: Early-initialization of NIDs for the memory-allocator.