[OPW,kernel,v2] mm: Make debug.c optional.
diff mbox

Message ID 20141030164524.GA25838@mango
State New, archived
Headers show

Commit Message

Kumari Radha Oct. 30, 2014, 4:45 p.m. UTC
This patch makes debug.c optional. It compiles out two functions, dump_page
and dump_page_badflags in debug.c by making it depend on CONFIG_PRINTK. 
This reduces the kernel size by 393 bytes.

Bloat-o-meter output(vmlinux.old vs vmlinux):
add/remove: 1/4 grow/shrink: 1/4 up/down: 139/-532 (-393)
function                                     old     new   delta
bad_page.isra                                  -     137    +137
vm_normal_page                                87      89      +2
unmap_single_vma                             967     961      -6
dump_page                                      7       -      -7
get_page_from_freelist                      1348    1334     -14
print_bad_pte.isra                           131     112     -19
destroy_compound_page                        164     124     -40
dump_page_badflags                           121       -    -121
bad_page                                     149       -    -149
pageflag_names                               176       -    -176

Signed-off-by: Kumari Radha <kumari.radha3@gmail.com>
---
Changes in v2:
    - removed Kconfig symobol and moved the stubs to linux/mmdebug.h.

 include/linux/mmdebug.h |    9 +++++++++
 mm/Makefile             |    3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)

Patch
diff mbox

diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index 877ef22..73c4ea9 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -7,9 +7,18 @@  struct page;
 struct vm_area_struct;
 struct mm_struct;
 
+#ifdef CONFIG_PRINTK
 extern void dump_page(struct page *page, const char *reason);
 extern void dump_page_badflags(struct page *page, const char *reason,
 			       unsigned long badflags);
+#else
+static inline void dump_page(struct page *page, const char *reason)
+{}
+static inline void dump_page_badflags(struct page *page, const char *reason,
+				unsigned long badflags)
+{}
+#endif
+
 void dump_vma(const struct vm_area_struct *vma);
 void dump_mm(const struct mm_struct *mm);
 
diff --git a/mm/Makefile b/mm/Makefile
index 8405eb0..a57b4df 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -18,8 +18,9 @@  obj-y			:= filemap.o mempool.o oom_kill.o \
 			   mm_init.o mmu_context.o percpu.o slab_common.o \
 			   compaction.o vmacache.o \
 			   interval_tree.o list_lru.o workingset.o \
-			   iov_iter.o debug.o $(mmu-y)
+			   iov_iter.o $(mmu-y)
 
+obj-$(CONFIG_PRINTK)   += debug.o
 obj-y += init-mm.o
 
 ifdef CONFIG_NO_BOOTMEM