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

Message ID 20141110211701.GA17892@mango
State New, archived
Headers show

Commit Message

Kumari Radha Nov. 10, 2014, 9:17 p.m. UTC
This patch makes debug.c optional. It compiles out few memory debug routines
by making them 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 v3:
    - Added stubs for dump_vma and dump_mm.

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

Comments

Sarah Sharp Nov. 12, 2014, 12:43 a.m. UTC | #1
Hi Kumari,

Now that the application period is over, please send patches directly to
the staging mailing list, or to the maintainers (in this case, getting
Josh's ack first).

Thanks,
Sarah Sharp

On Tue, Nov 11, 2014 at 02:47:01AM +0530, Kumari Radha wrote:
> This patch makes debug.c optional. It compiles out few memory debug routines
> by making them 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 v3:
>     - Added stubs for dump_vma and dump_mm.
> 
>  include/linux/mmdebug.h |   12 ++++++++++++
>  mm/Makefile             |    3 ++-
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
> index 877ef22..7c4cda5 100644
> --- a/include/linux/mmdebug.h
> +++ b/include/linux/mmdebug.h
> @@ -7,11 +7,23 @@ 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);
>  void dump_vma(const struct vm_area_struct *vma);
>  void dump_mm(const struct mm_struct *mm);
> +#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)
> +{}
> +static inline void dump_vma(const struct vm_area_struct *vma)
> +{}
> +static inline void dump_mm(const struct mm_struct *mm)
> +{}
> +#endif
>  
>  #ifdef CONFIG_DEBUG_VM
>  #define VM_BUG_ON(cond) BUG_ON(cond)
> 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
> -- 
> 1.7.9.5
> 
> -- 
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Patch
diff mbox

diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index 877ef22..7c4cda5 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -7,11 +7,23 @@  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);
 void dump_vma(const struct vm_area_struct *vma);
 void dump_mm(const struct mm_struct *mm);
+#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)
+{}
+static inline void dump_vma(const struct vm_area_struct *vma)
+{}
+static inline void dump_mm(const struct mm_struct *mm)
+{}
+#endif
 
 #ifdef CONFIG_DEBUG_VM
 #define VM_BUG_ON(cond) BUG_ON(cond)
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