Commit 36bd9310 authored by Liam R. Howlett's avatar Liam R. Howlett Committed by Andrew Morton

mm: update vma_iter_store() to use MAS_WARN_ON()

MAS_WARN_ON() will provide more information on the maple state and can be
more useful for debugging.  Use this version of WARN_ON() in the debugging
code when storing to the tree.

Update the printk to a pr_warn(), but this will only be printed when maple
tree debug is enabled anyways.

Making all print statements into one will keep them together on a busy
terminal.

Link: https://lkml.kernel.org/r/20230518145544.1722059-19-Liam.Howlett@oracle.comSigned-off-by: default avatarLiam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Cc: David Binderman <dcb314@hotmail.com>
Cc: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: Vernon Yang <vernon2gm@gmail.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent b50e195f
...@@ -1060,18 +1060,17 @@ static inline void vma_iter_store(struct vma_iterator *vmi, ...@@ -1060,18 +1060,17 @@ static inline void vma_iter_store(struct vma_iterator *vmi,
{ {
#if defined(CONFIG_DEBUG_VM_MAPLE_TREE) #if defined(CONFIG_DEBUG_VM_MAPLE_TREE)
if (WARN_ON(vmi->mas.node != MAS_START && vmi->mas.index > vma->vm_start)) { if (MAS_WARN_ON(&vmi->mas, vmi->mas.node != MAS_START &&
printk("%lu > %lu\n", vmi->mas.index, vma->vm_start); vmi->mas.index > vma->vm_start)) {
printk("store of vma %lu-%lu", vma->vm_start, vma->vm_end); pr_warn("%lx > %lx\n store vma %lx-%lx\n into slot %lx-%lx\n",
printk("into slot %lu-%lu", vmi->mas.index, vmi->mas.last); vmi->mas.index, vma->vm_start, vma->vm_start,
vma_iter_dump_tree(vmi); vma->vm_end, vmi->mas.index, vmi->mas.last);
} }
if (WARN_ON(vmi->mas.node != MAS_START && vmi->mas.last < vma->vm_start)) { if (MAS_WARN_ON(&vmi->mas, vmi->mas.node != MAS_START &&
printk("%lu < %lu\n", vmi->mas.last, vma->vm_start); vmi->mas.last < vma->vm_start)) {
printk("store of vma %lu-%lu", vma->vm_start, vma->vm_end); pr_warn("%lx < %lx\nstore vma %lx-%lx\ninto slot %lx-%lx\n",
printk("into slot %lu-%lu", vmi->mas.index, vmi->mas.last); vmi->mas.last, vma->vm_start, vma->vm_start, vma->vm_end,
mt_dump(vmi->mas.tree, mt_dump_hex); vmi->mas.index, vmi->mas.last);
vma_iter_dump_tree(vmi);
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment