[PATCH 04/11] mm: compaction: export some of the functions

Mel Gorman
2011-12-12T14:29:07Z

On Fri, Nov 18, 2011 at 05:43:11PM +0100, Marek Szyprowski wrote:
> From: Michal Nazarewicz <mina86@mina86.com>
>
> This commit exports some of the functions from compaction.c file
> outside of it adding their declaration into internal.h header
> file so that other mm related code can use them.
>
> This forced compaction.c to always be compiled (as opposed to being
> compiled only if CONFIG_COMPACTION is defined) but as to avoid
> introducing code that user did not ask for, part of the compaction.c
> is now wrapped in on #ifdef.
>
> Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> mm/Makefile | 3 +-
> mm/compaction.c | 112 +++++++++++++++++++++++--------------------------------
> mm/internal.h | 35 +++++++++++++++++
> 3 files changed, 83 insertions(+), 67 deletions(-)
>
> diff --git a/mm/Makefile b/mm/Makefile
> index 50ec00e..24ed801 100644
> --- a/mm/Makefile
> +++ b/mm/Makefile
> @@ -13,7 +13,7 @@ obj-y := filemap.o mempool.o oom_kill.o fadvise.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)
> + $(mmu-y) compaction.o

That should be

compaction.o $(mmu-y)

for consistency.

Overall, this patch implies that CMA is always compiled in. Why
not just make CMA depend on COMPACTION to keep things simplier? For
example, if you enable CMA and do not enable COMPACTION, you lose
things like the vmstat counters that can aid debugging. In fact, as
parts of compaction.c are using defines like COMPACTBLOCKS, I'm not
even sure compaction.c can compile without CONFIG_COMPACTION because
of the vmstat stuff.

--
Mel Gorman
SUSE Labs