ARM: Whether a bank must be fully contained by a section?

From: Wang Nan
Date: Thu Jan 02 2014 - 02:56:03 EST


Hi Russell,

By reading the code of show_mem(), I found that there is an assumption
that the page structs must be continuous for each bank:

for_each_bank (i, mi) {
...
page = pfn_to_page(pfn1);
end = pfn_to_page(pfn2 - 1) + 1;

do {
...
page++; <-- pageframe must be continuous
...
} while (page < end);
...
}

Therefore, a bank must be fully contained in a section in sparse memory
mode, because page frames are allocated section by section (in
sparse_init()).

However, I didn't find other code which enforces this assumption.
Instead, in arm_memory_present (arch/arm/mm/init.c), it seems that a
bank may contain more than one section:

arm_memory_present:
...
for_each_memblock(memory, reg)
memory_present(0, memblock_region_memory_base_pfn(reg),
memblock_region_memory_end_pfn(reg));
...

memory_present:
...
for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) {
...
}
...


Therefore, would you please consider the following patch, which removes
the assumption that a bank must be fully contained in one section?


===========================