Re: [RFC 03/11] mm: debug: dump VMA into a string rather than directly on screen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 14, 2015 at 04:56:25PM -0400, Sasha Levin wrote:
> This lets us use regular string formatting code to dump VMAs, use it
> in VM_BUG_ON_VMA instead of just printing it to screen as well.
> 
> Signed-off-by: Sasha Levin <sasha.levin@xxxxxxxxxx>
> ---
>  include/linux/mmdebug.h |    8 ++++++--
>  lib/vsprintf.c          |    7 +++++--
>  mm/debug.c              |   26 ++++++++++++++------------
>  3 files changed, 25 insertions(+), 16 deletions(-)
> 
> diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
> index 877ef22..506e405 100644
> --- a/include/linux/mmdebug.h
> +++ b/include/linux/mmdebug.h
> @@ -10,10 +10,10 @@ struct mm_struct;
>  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);
>  
>  #ifdef CONFIG_DEBUG_VM
> +char *format_vma(const struct vm_area_struct *vma, char *buf, char *end);
>  #define VM_BUG_ON(cond) BUG_ON(cond)
>  #define VM_BUG_ON_PAGE(cond, page)					\
>  	do {								\
> @@ -25,7 +25,7 @@ void dump_mm(const struct mm_struct *mm);
>  #define VM_BUG_ON_VMA(cond, vma)					\
>  	do {								\
>  		if (unlikely(cond)) {					\
> -			dump_vma(vma);					\
> +			pr_emerg("%pZv", vma);				\
>  			BUG();						\
>  		}							\
>  	} while (0)
> @@ -40,6 +40,10 @@ void dump_mm(const struct mm_struct *mm);
>  #define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond)
>  #define VM_WARN_ONCE(cond, format...) WARN_ONCE(cond, format)
>  #else
> +static char *format_vma(const struct vm_area_struct *vma, char *buf, char *end)
> +{

Again: print address ?

> +	return buf;
> +}
>  #define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
>  #define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
>  #define VM_BUG_ON_VMA(cond, vma) VM_BUG_ON(cond)
-- 
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]