aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2014-10-09 18:28:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-09 22:25:58 -0400
commit31c9afa6db122a5c7a7843278aaf77dd08ea6e98 (patch)
treeaaa9854a4b07f458a0972141de3ee0a77d264641 /mm
parent82742a3a5152195edd69528c0c9a1a6fb9caa293 (diff)
mm: introduce VM_BUG_ON_MM
Very similar to VM_BUG_ON_PAGE and VM_BUG_ON_VMA, dump struct_mm when the bug is hit. [akpm@linux-foundation.org: coding-style fixes] [mhocko@suse.cz: fix build] [mhocko@suse.cz: fix build some more] [akpm@linux-foundation.org: do strange things to avoid doing strange things for the comma separators] Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Cc: Dave Jones <davej@redhat.com> Signed-off-by: Michal Hocko <mhocko@suse.cz> Cc: Valdis Kletnieks <Valdis.Kletnieks@vt.edu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/debug.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/mm/debug.c b/mm/debug.c
index 697df9050193..5a1b6194089c 100644
--- a/mm/debug.c
+++ b/mm/debug.c
@@ -1,3 +1,10 @@
1/*
2 * mm/debug.c
3 *
4 * mm/ specific debug routines.
5 *
6 */
7
1#include <linux/kernel.h> 8#include <linux/kernel.h>
2#include <linux/mm.h> 9#include <linux/mm.h>
3#include <linux/ftrace_event.h> 10#include <linux/ftrace_event.h>
@@ -159,4 +166,75 @@ void dump_vma(const struct vm_area_struct *vma)
159} 166}
160EXPORT_SYMBOL(dump_vma); 167EXPORT_SYMBOL(dump_vma);
161 168
169void dump_mm(const struct mm_struct *mm)
170{
171 printk(KERN_ALERT
172 "mm %p mmap %p seqnum %d task_size %lu\n"
173#ifdef CONFIG_MMU
174 "get_unmapped_area %p\n"
175#endif
176 "mmap_base %lu mmap_legacy_base %lu highest_vm_end %lu\n"
177 "pgd %p mm_users %d mm_count %d nr_ptes %lu map_count %d\n"
178 "hiwater_rss %lx hiwater_vm %lx total_vm %lx locked_vm %lx\n"
179 "pinned_vm %lx shared_vm %lx exec_vm %lx stack_vm %lx\n"
180 "start_code %lx end_code %lx start_data %lx end_data %lx\n"
181 "start_brk %lx brk %lx start_stack %lx\n"
182 "arg_start %lx arg_end %lx env_start %lx env_end %lx\n"
183 "binfmt %p flags %lx core_state %p\n"
184#ifdef CONFIG_AIO
185 "ioctx_table %p\n"
186#endif
187#ifdef CONFIG_MEMCG
188 "owner %p "
189#endif
190 "exe_file %p\n"
191#ifdef CONFIG_MMU_NOTIFIER
192 "mmu_notifier_mm %p\n"
193#endif
194#ifdef CONFIG_NUMA_BALANCING
195 "numa_next_scan %lu numa_scan_offset %lu numa_scan_seq %d\n"
196#endif
197#if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION)
198 "tlb_flush_pending %d\n"
199#endif
200 "%s", /* This is here to hold the comma */
201
202 mm, mm->mmap, mm->vmacache_seqnum, mm->task_size,
203#ifdef CONFIG_MMU
204 mm->get_unmapped_area,
205#endif
206 mm->mmap_base, mm->mmap_legacy_base, mm->highest_vm_end,
207 mm->pgd, atomic_read(&mm->mm_users),
208 atomic_read(&mm->mm_count),
209 atomic_long_read((atomic_long_t *)&mm->nr_ptes),
210 mm->map_count,
211 mm->hiwater_rss, mm->hiwater_vm, mm->total_vm, mm->locked_vm,
212 mm->pinned_vm, mm->shared_vm, mm->exec_vm, mm->stack_vm,
213 mm->start_code, mm->end_code, mm->start_data, mm->end_data,
214 mm->start_brk, mm->brk, mm->start_stack,
215 mm->arg_start, mm->arg_end, mm->env_start, mm->env_end,
216 mm->binfmt, mm->flags, mm->core_state,
217#ifdef CONFIG_AIO
218 mm->ioctx_table,
219#endif
220#ifdef CONFIG_MEMCG
221 mm->owner,
222#endif
223 mm->exe_file,
224#ifdef CONFIG_MMU_NOTIFIER
225 mm->mmu_notifier_mm,
226#endif
227#ifdef CONFIG_NUMA_BALANCING
228 mm->numa_next_scan, mm->numa_scan_offset, mm->numa_scan_seq,
229#endif
230#if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION)
231 mm->tlb_flush_pending,
232#endif
233 "" /* This is here to not have a comma! */
234 );
235
236 dump_flags(mm->def_flags, vmaflags_names,
237 ARRAY_SIZE(vmaflags_names));
238}
239
162#endif /* CONFIG_DEBUG_VM */ 240#endif /* CONFIG_DEBUG_VM */