[OPW,kernel] mm: Compile out virtual memory debugging routines.
diff mbox

Message ID 20141031033237.GA2597@mango
State New, archived
Headers show

Commit Message

Kumari Radha Oct. 31, 2014, 3:32 a.m. UTC
This patch compiles out dump_vma and dump_mm if DEBUG_KERNEL
and PRINTK are not set.

Signed-off-by: Kumari Radha <kumari.radha3@gmail.com>
---
 include/linux/mmdebug.h |    7 +++++++
 lib/Kconfig.debug       |    2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

Comments

Josh Triplett Oct. 31, 2014, 4:14 a.m. UTC | #1
On Fri, Oct 31, 2014 at 09:02:37AM +0530, Kumari Radha wrote:
> This patch compiles out dump_vma and dump_mm if DEBUG_KERNEL
> and PRINTK are not set.
> 
> Signed-off-by: Kumari Radha <kumari.radha3@gmail.com>

This appears to be an incremental patch on top of your previous one.
Did you mean to amend this into your previous patch?

- Josh Triplett

>  include/linux/mmdebug.h |    7 +++++++
>  lib/Kconfig.debug       |    2 +-
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
> index 73c4ea9..4def4e5 100644
> --- a/include/linux/mmdebug.h
> +++ b/include/linux/mmdebug.h
> @@ -19,8 +19,15 @@ static inline void dump_page_badflags(struct page *page, const char *reason,
>  {}
>  #endif
>  
> +#ifdef CONFIG_DEBUG_VM
>  void dump_vma(const struct vm_area_struct *vma);
>  void dump_mm(const struct mm_struct *mm);
> +#else
> +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/lib/Kconfig.debug b/lib/Kconfig.debug
> index 4e35a5d..786f3ed 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -518,7 +518,7 @@ config DEBUG_STACK_USAGE
>  
>  config DEBUG_VM
>  	bool "Debug VM"
> -	depends on DEBUG_KERNEL
> +	depends on DEBUG_KERNEL && PRINTK
>  	help
>  	  Enable this to turn on extended checks in the virtual-memory system
>            that may impact performance.
> -- 
> 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.
Kumari Radha Oct. 31, 2014, 4:47 a.m. UTC | #2
On 31 October 2014 09:44:00 GMT+05:30, Josh Triplett <josh@joshtriplett.org> wrote:
>On Fri, Oct 31, 2014 at 09:02:37AM +0530, Kumari Radha wrote:
>> This patch compiles out dump_vma and dump_mm if DEBUG_KERNEL
>> and PRINTK are not set.
>> 
>> Signed-off-by: Kumari Radha <kumari.radha3@gmail.com>
>
>This appears to be an incremental patch on top of your previous one.
>Did you mean to amend this into your previous patch?
>

Yes I thought of sending this patch as a part of previous patch but since you suggested that moving the prototype for those two functions into #ifdef CONFIG_DEBUG_VM should be a completely separate patch, I sent it as a separate patch(missed the bloat-o-meter output, a mistake from my side, sorry ).

Thanks
Radha 

>- Josh Triplett
>
>>  include/linux/mmdebug.h |    7 +++++++
>>  lib/Kconfig.debug       |    2 +-
>>  2 files changed, 8 insertions(+), 1 deletion(-)
>> 
>> diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
>> index 73c4ea9..4def4e5 100644
>> --- a/include/linux/mmdebug.h
>> +++ b/include/linux/mmdebug.h
>> @@ -19,8 +19,15 @@ static inline void dump_page_badflags(struct page
>*page, const char *reason,
>>  {}
>>  #endif
>>  
>> +#ifdef CONFIG_DEBUG_VM
>>  void dump_vma(const struct vm_area_struct *vma);
>>  void dump_mm(const struct mm_struct *mm);
>> +#else
>> +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/lib/Kconfig.debug b/lib/Kconfig.debug
>> index 4e35a5d..786f3ed 100644
>> --- a/lib/Kconfig.debug
>> +++ b/lib/Kconfig.debug
>> @@ -518,7 +518,7 @@ config DEBUG_STACK_USAGE
>>  
>>  config DEBUG_VM
>>  	bool "Debug VM"
>> -	depends on DEBUG_KERNEL
>> +	depends on DEBUG_KERNEL && PRINTK
>>  	help
>>  	  Enable this to turn on extended checks in the virtual-memory
>system
>>            that may impact performance.
>> -- 
>> 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.
Josh Triplett Oct. 31, 2014, 5:22 a.m. UTC | #3
On Fri, Oct 31, 2014 at 10:17:24AM +0530, Radha wrote:
> 
> 
> On 31 October 2014 09:44:00 GMT+05:30, Josh Triplett <josh@joshtriplett.org> wrote:
> >On Fri, Oct 31, 2014 at 09:02:37AM +0530, Kumari Radha wrote:
> >> This patch compiles out dump_vma and dump_mm if DEBUG_KERNEL
> >> and PRINTK are not set.
> >> 
> >> Signed-off-by: Kumari Radha <kumari.radha3@gmail.com>
> >
> >This appears to be an incremental patch on top of your previous one.
> >Did you mean to amend this into your previous patch?
> >
> 
> Yes I thought of sending this patch as a part of previous patch but since you suggested that moving the prototype for those two functions into #ifdef CONFIG_DEBUG_VM should be a completely separate patch, I sent it as a separate patch(missed the bloat-o-meter output, a mistake from my side, sorry ).

I just looked back at the previous patch and feedback, and now I'm less
confused; sorry. :)

Yes, this should be a separate patch, not part of the previous patch.
However, I didn't mean that you should add stubs for dump_vma or
dump_mm; those functions are *only* called from within macros that only
exist when CONFIG_DEBUG_VM.  So, you can just move the prototypes a few
lines down, into the top of the existing ifdef block below them, and
leave them undefined if that macro isn't defined.

You also shouldn't make the Kconfig change here, at least not as part of
this patch.  Given that users can already compile out DEBUG_VM, making
it depend on PRINTK doesn't really make the kernel any smaller or easier
to configure.

- Josh Triplett

> >>  include/linux/mmdebug.h |    7 +++++++
> >>  lib/Kconfig.debug       |    2 +-
> >>  2 files changed, 8 insertions(+), 1 deletion(-)
> >> 
> >> diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
> >> index 73c4ea9..4def4e5 100644
> >> --- a/include/linux/mmdebug.h
> >> +++ b/include/linux/mmdebug.h
> >> @@ -19,8 +19,15 @@ static inline void dump_page_badflags(struct page
> >*page, const char *reason,
> >>  {}
> >>  #endif
> >>  
> >> +#ifdef CONFIG_DEBUG_VM
> >>  void dump_vma(const struct vm_area_struct *vma);
> >>  void dump_mm(const struct mm_struct *mm);
> >> +#else
> >> +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/lib/Kconfig.debug b/lib/Kconfig.debug
> >> index 4e35a5d..786f3ed 100644
> >> --- a/lib/Kconfig.debug
> >> +++ b/lib/Kconfig.debug
> >> @@ -518,7 +518,7 @@ config DEBUG_STACK_USAGE
> >>  
> >>  config DEBUG_VM
> >>  	bool "Debug VM"
> >> -	depends on DEBUG_KERNEL
> >> +	depends on DEBUG_KERNEL && PRINTK
> >>  	help
> >>  	  Enable this to turn on extended checks in the virtual-memory
> >system
> >>            that may impact performance.
> >> -- 
> >> 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.
> 
> -- 
> 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 73c4ea9..4def4e5 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -19,8 +19,15 @@  static inline void dump_page_badflags(struct page *page, const char *reason,
 {}
 #endif
 
+#ifdef CONFIG_DEBUG_VM
 void dump_vma(const struct vm_area_struct *vma);
 void dump_mm(const struct mm_struct *mm);
+#else
+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/lib/Kconfig.debug b/lib/Kconfig.debug
index 4e35a5d..786f3ed 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -518,7 +518,7 @@  config DEBUG_STACK_USAGE
 
 config DEBUG_VM
 	bool "Debug VM"
-	depends on DEBUG_KERNEL
+	depends on DEBUG_KERNEL && PRINTK
 	help
 	  Enable this to turn on extended checks in the virtual-memory system
           that may impact performance.