mm: /proc/pid/smaps_rollup: fix maple tree search

Message ID 3011bee7-182-97a2-1083-d5f5b688e54b@google.com
State New
Headers
Series mm: /proc/pid/smaps_rollup: fix maple tree search |

Commit Message

Hugh Dickins Oct. 19, 2022, 3:18 a.m. UTC
  /proc/pid/smaps_rollup showed 0 kB for everything: now find first vma.

Fixes: c4c84f06285e ("fs/proc/task_mmu: stop using linked list and highest_vm_end")
Signed-off-by: Hugh Dickins <hughd@google.com>
---

 fs/proc/task_mmu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Liam R. Howlett Oct. 20, 2022, 3:31 p.m. UTC | #1
Thanks Hugh.  I guess this 'optimisation' was a little more aggressive
and a little more buggy than needed.

Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>

* Hugh Dickins <hughd@google.com> [221018 23:18]:
> /proc/pid/smaps_rollup showed 0 kB for everything: now find first vma.
> 
> Fixes: c4c84f06285e ("fs/proc/task_mmu: stop using linked list and highest_vm_end")
> Signed-off-by: Hugh Dickins <hughd@google.com>
> ---
> 
>  fs/proc/task_mmu.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- 6.1-rc1/fs/proc/task_mmu.c
> +++ linux/fs/proc/task_mmu.c
> @@ -902,7 +902,7 @@ static int show_smaps_rollup(struct seq_
>  		goto out_put_mm;
>  
>  	hold_task_mempolicy(priv);
> -	vma = mas_find(&mas, 0);
> +	vma = mas_find(&mas, ULONG_MAX);
>  
>  	if (unlikely(!vma))
>  		goto empty_set;
  

Patch

--- 6.1-rc1/fs/proc/task_mmu.c
+++ linux/fs/proc/task_mmu.c
@@ -902,7 +902,7 @@  static int show_smaps_rollup(struct seq_
 		goto out_put_mm;
 
 	hold_task_mempolicy(priv);
-	vma = mas_find(&mas, 0);
+	vma = mas_find(&mas, ULONG_MAX);
 
 	if (unlikely(!vma))
 		goto empty_set;