* [PATCH] mm/smaps: Use vma->vm_pgoff directly when counting partial swap
@ 2021-09-16 21:58 Peter Xu
2021-09-16 22:17 ` Vlastimil Babka
0 siblings, 1 reply; 3+ messages in thread
From: Peter Xu @ 2021-09-16 21:58 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: peterx, Andrew Morton, Vlastimil Babka, Hugh Dickins
linear_page_index(vma, vma->vm_start) of a shmem vma is exactly vm_pgoff.
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
mm/shmem.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 96ccf6e941aa..2aef5b8e17c9 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -856,8 +856,7 @@ unsigned long shmem_swap_usage(struct vm_area_struct *vma)
return swapped << PAGE_SHIFT;
/* Here comes the more involved part */
- return shmem_partial_swap_usage(mapping,
- linear_page_index(vma, vma->vm_start),
+ return shmem_partial_swap_usage(mapping, vma->vm_pgoff,
linear_page_index(vma, vma->vm_end));
}
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/smaps: Use vma->vm_pgoff directly when counting partial swap
2021-09-16 21:58 [PATCH] mm/smaps: Use vma->vm_pgoff directly when counting partial swap Peter Xu
@ 2021-09-16 22:17 ` Vlastimil Babka
2021-09-17 0:29 ` Peter Xu
0 siblings, 1 reply; 3+ messages in thread
From: Vlastimil Babka @ 2021-09-16 22:17 UTC (permalink / raw)
To: Peter Xu, linux-mm, linux-kernel; +Cc: Andrew Morton, Hugh Dickins
On 9/16/21 11:58 PM, Peter Xu wrote:
> linear_page_index(vma, vma->vm_start) of a shmem vma is exactly vm_pgoff.
Could you use "vma->vm_pgoff + vma_pages(vma)" instead of the other
linear_page_index() then?
But now I wonder, is smaps_pte_hole() broken? it calls
shmem_partial_swap_usage with addresses, not pgoffs?
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Hugh Dickins <hughd@google.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
> mm/shmem.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 96ccf6e941aa..2aef5b8e17c9 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -856,8 +856,7 @@ unsigned long shmem_swap_usage(struct vm_area_struct *vma)
> return swapped << PAGE_SHIFT;
>
> /* Here comes the more involved part */
> - return shmem_partial_swap_usage(mapping,
> - linear_page_index(vma, vma->vm_start),
> + return shmem_partial_swap_usage(mapping, vma->vm_pgoff,
> linear_page_index(vma, vma->vm_end));
> }
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/smaps: Use vma->vm_pgoff directly when counting partial swap
2021-09-16 22:17 ` Vlastimil Babka
@ 2021-09-17 0:29 ` Peter Xu
0 siblings, 0 replies; 3+ messages in thread
From: Peter Xu @ 2021-09-17 0:29 UTC (permalink / raw)
To: Vlastimil Babka; +Cc: linux-mm, linux-kernel, Andrew Morton, Hugh Dickins
On Fri, Sep 17, 2021 at 12:17:32AM +0200, Vlastimil Babka wrote:
> On 9/16/21 11:58 PM, Peter Xu wrote:
> > linear_page_index(vma, vma->vm_start) of a shmem vma is exactly vm_pgoff.
>
> Could you use "vma->vm_pgoff + vma_pages(vma)" instead of the other
> linear_page_index() then?
Sure.
>
> But now I wonder, is smaps_pte_hole() broken? it calls
> shmem_partial_swap_usage with addresses, not pgoffs?
Hmm, that seems true.. I guess it still gets the right number when start==0
and when the vma covers the whole file (which could be the simplest scenario),
but not otherwise.
I'll add a new patch.
Thanks,
--
Peter Xu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-17 0:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 21:58 [PATCH] mm/smaps: Use vma->vm_pgoff directly when counting partial swap Peter Xu
2021-09-16 22:17 ` Vlastimil Babka
2021-09-17 0:29 ` Peter Xu
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.