Re: [PATCH 18/34] mm: Update vma_iter_store() to use MAS_WARN_ON()

From: Liam R. Howlett
Date: Wed Apr 26 2023 - 21:17:38 EST


* Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> [230426 21:07]:
> Cc-ing Petr
>
> On (23/04/25 10:09), Liam R. Howlett wrote:
> > + if (MAS_WARN_ON(&vmi->mas, vmi->mas.node != MAS_START &&
> > + vmi->mas.index > vma->vm_start)) {
> > + printk("%lx > %lx\n", vmi->mas.index, vma->vm_start);
> > + printk("store of vma %lx-%lx", vma->vm_start, vma->vm_end);
> > + printk("into slot %lx-%lx", vmi->mas.index, vmi->mas.last);
> > }
>
> [..]
>
> > + if (MAS_WARN_ON(&vmi->mas, vmi->mas.node != MAS_START &&
> > + vmi->mas.last < vma->vm_start)) {
> > + printk("%lx < %lx\n", vmi->mas.last, vma->vm_start);
> > + printk("store of vma %lx-%lx", vma->vm_start, vma->vm_end);
> > + printk("into slot %lx-%lx", vmi->mas.index, vmi->mas.last);
> > }
>
> Any reason for "store of vma" and "into slot" to be two separate
> printk()-s? It's not guaranteed that these will be printed as a
> continuous line. A single printk should work fine:
>
> pr_foo("store of vma %lx-%lx into slot %lx-%lx", ...);
>

Really, just for readability. I'll split the string literal instead.

> The line probably needs to be terminated with \n unless you expect
> more pr_cont() printks after this, which doesn't look like a case.
> Additionally, do you want to pass a specific loglevel? E.g. pr_debug()?

Yes, I should do both of these, thanks.