All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Yuanyuan Zhong <yzhong@purestorage.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Matthew Wilcox <willy@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Mohamed Khalfella <mkhalfella@purestorage.com>
Subject: Re: [PATCH] mm: /proc/pid/smaps_rollup: avoid skipping vma after getting mmap_lock again
Date: Mon, 27 May 2024 09:33:27 +0200	[thread overview]
Message-ID: <2c8c4ddd-3b5e-49cb-9391-c249c27fdd2d@redhat.com> (raw)
In-Reply-To: <20240523183531.2535436-1-yzhong@purestorage.com>

Am 23.05.24 um 20:35 schrieb Yuanyuan Zhong:
> After switching smaps_rollup to use VMA iterator, searching for next
> entry is part of the condition expression of the do-while loop. So the
> current VMA needs to be addressed before the continue statement.
> 
> Fixes: c4c84f06285e ("fs/proc/task_mmu: stop using linked list and highest_vm_end")
> Signed-off-by: Yuanyuan Zhong <yzhong@purestorage.com>
> Reviewed-by: Mohamed Khalfella <mkhalfella@purestorage.com>
> ---
>   fs/proc/task_mmu.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index e5a5f015ff03..f8d35f993fe5 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -970,12 +970,17 @@ static int show_smaps_rollup(struct seq_file *m, void *v)
>   				break;
>   
>   			/* Case 1 and 2 above */
> -			if (vma->vm_start >= last_vma_end)
> +			if (vma->vm_start >= last_vma_end) {
> +				smap_gather_stats(vma, &mss, 0);
> +				last_vma_end = vma->vm_end;
>   				continue;
> +			}
>   
>   			/* Case 4 above */
> -			if (vma->vm_end > last_vma_end)
> +			if (vma->vm_end > last_vma_end) {
>   				smap_gather_stats(vma, &mss, last_vma_end);
> +				last_vma_end = vma->vm_end;
> +			}
>   		}
>   	} for_each_vma(vmi, vma);
>   

Looks correct to me. I guess getting a reproducer is rather tricky.

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb


      parent reply	other threads:[~2024-05-27  7:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23 18:35 [PATCH] mm: /proc/pid/smaps_rollup: avoid skipping vma after getting mmap_lock again Yuanyuan Zhong
2024-05-23 18:56 ` Andrew Morton
2024-05-23 19:16   ` Yuanyuan Zhong
2024-05-24  3:02     ` Andrew Morton
2024-05-27  7:33 ` David Hildenbrand [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2c8c4ddd-3b5e-49cb-9391-c249c27fdd2d@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkhalfella@purestorage.com \
    --cc=willy@infradead.org \
    --cc=yzhong@purestorage.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.