Skip to content

Commit

Permalink
bootmem: Separate out CONFIG_NO_BOOTMEM code into nobootmem.c
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Yinghai Lu <[email protected]>
Acked-by: Andrew Morton <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
  • Loading branch information
Yinghai Lu authored and htejun committed Feb 24, 2011
1 parent 2bf5055 commit 0932587
Show file tree
Hide file tree
Showing 3 changed files with 415 additions and 171 deletions.
8 changes: 7 additions & 1 deletion mm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ mmu-$(CONFIG_MMU) := fremap.o highmem.o madvise.o memory.o mincore.o \
mlock.o mmap.o mprotect.o mremap.o msync.o rmap.o \
vmalloc.o pagewalk.o pgtable-generic.o

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

ifdef CONFIG_NO_BOOTMEM
obj-y += nobootmem.o
else
obj-y += bootmem.o
endif

obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o

obj-$(CONFIG_BOUNCE) += bounce.o
Expand Down
Loading

0 comments on commit 0932587

Please sign in to comment.