/* Although written for the SPARSEMEM_EXTREME case, this happens to also work for the flat array case because NR_SECTION_ROOTS==NR_MEM_SECTIONS.  */
int __section_nr(struct mem_section *ms)
/* Although written for the SPARSEMEM_EXTREME case, this happens to also work for the flat array case because NR_SECTION_ROOTS==NR_MEM_SECTIONS.  */
int __section_nr(struct mem_section *ms)
{
	unsigned long root_nr;
	struct mem_section* root;
	for (root_nr = 0; root_nr < NR_SECTION_ROOTS; root_nr++) {
		root = __nr_to_section(root_nr * SECTIONS_PER_ROOT);
		if (!root)
			continue;
		if ((ms >= root) && (ms < (root + SECTIONS_PER_ROOT)))
		     break;
	}
	return (root_nr * SECTIONS_PER_ROOT) + (ms - root);
}