aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2014-10-09 18:28:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-09 22:25:58 -0400
commit82742a3a5152195edd69528c0c9a1a6fb9caa293 (patch)
tree0949f1c68de59c8fbd88b8af383383bb882f8520 /mm/page_alloc.c
parent81d0fa623c5b8dbd5279d9713094b0f9b0a00fb4 (diff)
mm: move debug code out of page_alloc.c
dump_page() and dump_vma() are not specific to page_alloc.c, move them out so page_alloc.c won't turn into the unofficial debug repository. Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c160
1 files changed, 0 insertions, 160 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index bfb73e025e02..c9710c9bbee2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -53,8 +53,6 @@
53#include <linux/kmemleak.h> 53#include <linux/kmemleak.h>
54#include <linux/compaction.h> 54#include <linux/compaction.h>
55#include <trace/events/kmem.h> 55#include <trace/events/kmem.h>
56#include <linux/ftrace_event.h>
57#include <linux/memcontrol.h>
58#include <linux/prefetch.h> 56#include <linux/prefetch.h>
59#include <linux/mm_inline.h> 57#include <linux/mm_inline.h>
60#include <linux/migrate.h> 58#include <linux/migrate.h>
@@ -6550,161 +6548,3 @@ bool is_free_buddy_page(struct page *page)
6550 return order < MAX_ORDER; 6548 return order < MAX_ORDER;
6551} 6549}
6552#endif 6550#endif
6553
6554static const struct trace_print_flags pageflag_names[] = {
6555 {1UL << PG_locked, "locked" },
6556 {1UL << PG_error, "error" },
6557 {1UL << PG_referenced, "referenced" },
6558 {1UL << PG_uptodate, "uptodate" },
6559 {1UL << PG_dirty, "dirty" },
6560 {1UL << PG_lru, "lru" },
6561 {1UL << PG_active, "active" },
6562 {1UL << PG_slab, "slab" },
6563 {1UL << PG_owner_priv_1, "owner_priv_1" },
6564 {1UL << PG_arch_1, "arch_1" },
6565 {1UL << PG_reserved, "reserved" },
6566 {1UL << PG_private, "private" },
6567 {1UL << PG_private_2, "private_2" },
6568 {1UL << PG_writeback, "writeback" },
6569#ifdef CONFIG_PAGEFLAGS_EXTENDED
6570 {1UL << PG_head, "head" },
6571 {1UL << PG_tail, "tail" },
6572#else
6573 {1UL << PG_compound, "compound" },
6574#endif
6575 {1UL << PG_swapcache, "swapcache" },
6576 {1UL << PG_mappedtodisk, "mappedtodisk" },
6577 {1UL << PG_reclaim, "reclaim" },
6578 {1UL << PG_swapbacked, "swapbacked" },
6579 {1UL << PG_unevictable, "unevictable" },
6580#ifdef CONFIG_MMU
6581 {1UL << PG_mlocked, "mlocked" },
6582#endif
6583#ifdef CONFIG_ARCH_USES_PG_UNCACHED
6584 {1UL << PG_uncached, "uncached" },
6585#endif
6586#ifdef CONFIG_MEMORY_FAILURE
6587 {1UL << PG_hwpoison, "hwpoison" },
6588#endif
6589#ifdef CONFIG_TRANSPARENT_HUGEPAGE
6590 {1UL << PG_compound_lock, "compound_lock" },
6591#endif
6592};
6593
6594static void dump_flags(unsigned long flags,
6595 const struct trace_print_flags *names, int count)
6596{
6597 const char *delim = "";
6598 unsigned long mask;
6599 int i;
6600
6601 printk(KERN_ALERT "flags: %#lx(", flags);
6602
6603 /* remove zone id */
6604 flags &= (1UL << NR_PAGEFLAGS) - 1;
6605
6606 for (i = 0; i < count && flags; i++) {
6607
6608 mask = names[i].mask;
6609 if ((flags & mask) != mask)
6610 continue;
6611
6612 flags &= ~mask;
6613 printk("%s%s", delim, names[i].name);
6614 delim = "|";
6615 }
6616
6617 /* check for left over flags */
6618 if (flags)
6619 printk("%s%#lx", delim, flags);
6620
6621 printk(")\n");
6622}
6623
6624void dump_page_badflags(struct page *page, const char *reason,
6625 unsigned long badflags)
6626{
6627 printk(KERN_ALERT
6628 "page:%p count:%d mapcount:%d mapping:%p index:%#lx\n",
6629 page, atomic_read(&page->_count), page_mapcount(page),
6630 page->mapping, page->index);
6631 BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS);
6632 dump_flags(page->flags, pageflag_names, ARRAY_SIZE(pageflag_names));
6633 if (reason)
6634 pr_alert("page dumped because: %s\n", reason);
6635 if (page->flags & badflags) {
6636 pr_alert("bad because of flags:\n");
6637 dump_flags(page->flags & badflags,
6638 pageflag_names, ARRAY_SIZE(pageflag_names));
6639 }
6640 mem_cgroup_print_bad_page(page);
6641}
6642
6643void dump_page(struct page *page, const char *reason)
6644{
6645 dump_page_badflags(page, reason, 0);
6646}
6647EXPORT_SYMBOL(dump_page);
6648
6649#ifdef CONFIG_DEBUG_VM
6650
6651static const struct trace_print_flags vmaflags_names[] = {
6652 {VM_READ, "read" },
6653 {VM_WRITE, "write" },
6654 {VM_EXEC, "exec" },
6655 {VM_SHARED, "shared" },
6656 {VM_MAYREAD, "mayread" },
6657 {VM_MAYWRITE, "maywrite" },
6658 {VM_MAYEXEC, "mayexec" },
6659 {VM_MAYSHARE, "mayshare" },
6660 {VM_GROWSDOWN, "growsdown" },
6661 {VM_PFNMAP, "pfnmap" },
6662 {VM_DENYWRITE, "denywrite" },
6663 {VM_LOCKED, "locked" },
6664 {VM_IO, "io" },
6665 {VM_SEQ_READ, "seqread" },
6666 {VM_RAND_READ, "randread" },
6667 {VM_DONTCOPY, "dontcopy" },
6668 {VM_DONTEXPAND, "dontexpand" },
6669 {VM_ACCOUNT, "account" },
6670 {VM_NORESERVE, "noreserve" },
6671 {VM_HUGETLB, "hugetlb" },
6672 {VM_NONLINEAR, "nonlinear" },
6673#if defined(CONFIG_X86)
6674 {VM_PAT, "pat" },
6675#elif defined(CONFIG_PPC)
6676 {VM_SAO, "sao" },
6677#elif defined(CONFIG_PARISC) || defined(CONFIG_METAG) || defined(CONFIG_IA64)
6678 {VM_GROWSUP, "growsup" },
6679#elif !defined(CONFIG_MMU)
6680 {VM_MAPPED_COPY, "mappedcopy" },
6681#else
6682 {VM_ARCH_1, "arch_1" },
6683#endif
6684 {VM_DONTDUMP, "dontdump" },
6685#ifdef CONFIG_MEM_SOFT_DIRTY
6686 {VM_SOFTDIRTY, "softdirty" },
6687#endif
6688 {VM_MIXEDMAP, "mixedmap" },
6689 {VM_HUGEPAGE, "hugepage" },
6690 {VM_NOHUGEPAGE, "nohugepage" },
6691 {VM_MERGEABLE, "mergeable" },
6692};
6693
6694void dump_vma(const struct vm_area_struct *vma)
6695{
6696 printk(KERN_ALERT
6697 "vma %p start %p end %p\n"
6698 "next %p prev %p mm %p\n"
6699 "prot %lx anon_vma %p vm_ops %p\n"
6700 "pgoff %lx file %p private_data %p\n",
6701 vma, (void *)vma->vm_start, (void *)vma->vm_end, vma->vm_next,
6702 vma->vm_prev, vma->vm_mm,
6703 (unsigned long)pgprot_val(vma->vm_page_prot),
6704 vma->anon_vma, vma->vm_ops, vma->vm_pgoff,
6705 vma->vm_file, vma->vm_private_data);
6706 dump_flags(vma->vm_flags, vmaflags_names, ARRAY_SIZE(vmaflags_names));
6707}
6708EXPORT_SYMBOL(dump_vma);
6709
6710#endif /* CONFIG_DEBUG_VM */