From: Dave Hansen It's only used in one file, and not in any critical paths, so make it out-of-line. Signed-off-by: Andrew Morton --- include/linux/mmzone.h | 26 +------------------------- mm/sparse.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) diff -puN include/linux/mmzone.h~memory-hotplug-prep-__section_nr-helper-fix include/linux/mmzone.h --- devel/include/linux/mmzone.h~memory-hotplug-prep-__section_nr-helper-fix 2005-09-07 20:10:27.000000000 -0700 +++ devel-akpm/include/linux/mmzone.h 2005-09-07 20:10:27.000000000 -0700 @@ -511,31 +511,7 @@ static inline struct mem_section *__nr_t return NULL; return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; } - -/* - * Although written for the SPARSEMEM_EXTREME case, this happens - * to also work for the flat array case becase - * NR_SECTION_ROOTS==NR_MEM_SECTIONS. - */ -static inline int __section_nr(struct mem_section* ms) -{ - unsigned long root_nr; - struct mem_section* root; - - for (root_nr = 0; - root_nr < NR_MEM_SECTIONS; - root_nr += SECTIONS_PER_ROOT) { - root = __nr_to_section(root_nr); - - if (!root) - continue; - - if ((ms >= root) && (ms < (root + SECTIONS_PER_ROOT))) - break; - } - - return (root_nr * SECTIONS_PER_ROOT) + (ms - root); -} +extern int __section_nr(struct mem_section* ms); /* * We use the lower bits of the mem_map pointer to store diff -puN mm/sparse.c~memory-hotplug-prep-__section_nr-helper-fix mm/sparse.c --- devel/mm/sparse.c~memory-hotplug-prep-__section_nr-helper-fix 2005-09-07 20:10:27.000000000 -0700 +++ devel-akpm/mm/sparse.c 2005-09-07 20:10:27.000000000 -0700 @@ -72,6 +72,31 @@ static inline int sparse_index_init(unsi } #endif +/* + * Although written for the SPARSEMEM_EXTREME case, this happens + * to also work for the flat array case becase + * 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_MEM_SECTIONS; + root_nr += SECTIONS_PER_ROOT) { + root = __nr_to_section(root_nr); + + if (!root) + continue; + + if ((ms >= root) && (ms < (root + SECTIONS_PER_ROOT))) + break; + } + + return (root_nr * SECTIONS_PER_ROOT) + (ms - root); +} + /* Record a memory area against a node. */ void memory_present(int nid, unsigned long start, unsigned long end) { _