Skip to content

Commit 0932587

Browse files
Yinghai Luhtejun
authored andcommitted
bootmem: Separate out CONFIG_NO_BOOTMEM code into nobootmem.c
mm/bootmem.c contained code paths for both bootmem and no bootmem configurations. They implement about the same set of APIs in different ways and as a result bootmem.c contains massive amount of #ifdef CONFIG_NO_BOOTMEM. Separate out CONFIG_NO_BOOTMEM code into mm/nobootmem.c. As the common part is relatively small, duplicate them in nobootmem.c instead of creating a common file or ifdef'ing in bootmem.c. The followings are duplicated. * {min|max}_low_pfn, max_pfn, saved_max_pfn * free_bootmem_late() * ___alloc_bootmem() * __alloc_bootmem_low() The followings are applicable only to nobootmem and moved verbatim. * __free_pages_memory() * free_all_memory_core_early() The followings are not applicable to nobootmem and omitted in nobootmem.c. * reserve_bootmem_node() * reserve_bootmem() The rest split function bodies according to CONFIG_NO_BOOTMEM. Makefile is updated so that only either bootmem.c or nobootmem.c is built according to CONFIG_NO_BOOTMEM. This patch doesn't introduce any behavior change. -tj: Rewrote commit description. Suggested-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Yinghai Lu <yinghai@kernel.org> Acked-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 2bf5055 commit 0932587

3 files changed

Lines changed: 415 additions & 171 deletions

File tree

‎mm/Makefile‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@ mmu-$(CONFIG_MMU) := fremap.o highmem.o madvise.o memory.o mincore.o \
77
mlock.o mmap.o mprotect.o mremap.o msync.o rmap.o \
88
vmalloc.o pagewalk.o pgtable-generic.o
99

10-
obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
10+
obj-y := filemap.o mempool.o oom_kill.o fadvise.o \
1111
maccess.o page_alloc.o page-writeback.o \
1212
readahead.o swap.o truncate.o vmscan.o shmem.o \
1313
prio_tree.o util.o mmzone.o vmstat.o backing-dev.o \
1414
page_isolation.o mm_init.o mmu_context.o percpu.o \
1515
$(mmu-y)
1616
obj-y += init-mm.o
1717

18+
ifdef CONFIG_NO_BOOTMEM
19+
obj-y += nobootmem.o
20+
else
21+
obj-y += bootmem.o
22+
endif
23+
1824
obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o
1925

2026
obj-$(CONFIG_BOUNCE) += bounce.o

0 commit comments

Comments
 (0)