lkml.org 
[lkml]   [2015]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC 03/11] mm: debug: dump VMA into a string rather than directly on screen
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@oracle.com>
> ---
> 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


\
 
 \ /
  Last update: 2015-04-30 19:01    [W:0.123 / U:1.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site