The patch titled Subject: mm/smaps: use vma->vm_pgoff directly when counting partial swap has been added to the -mm tree. Its filename is mm-smaps-use-vma-vm_pgoff-directly-when-counting-partial-swap.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-smaps-use-vma-vm_pgoff-directly-when-counting-partial-swap.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-smaps-use-vma-vm_pgoff-directly-when-counting-partial-swap.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Peter Xu <peterx@xxxxxxxxxx> Subject: mm/smaps: use vma->vm_pgoff directly when counting partial swap As it's trying to cover the whole vma anyways, use direct vm_pgoff value and vma_pages() rather than linear_page_index. Link: https://lkml.kernel.org/r/20210917164756.8586-3-peterx@xxxxxxxxxx Signed-off-by: Peter Xu <peterx@xxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/shmem.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/mm/shmem.c~mm-smaps-use-vma-vm_pgoff-directly-when-counting-partial-swap +++ a/mm/shmem.c @@ -856,9 +856,8 @@ unsigned long shmem_swap_usage(struct vm return swapped << PAGE_SHIFT; /* Here comes the more involved part */ - return shmem_partial_swap_usage(mapping, - linear_page_index(vma, vma->vm_start), - linear_page_index(vma, vma->vm_end)); + return shmem_partial_swap_usage(mapping, vma->vm_pgoff, + vma->vm_pgoff + vma_pages(vma)); } /* _ Patches currently in -mm which might be from peterx@xxxxxxxxxx are mm-smaps-fix-shmem-pte-hole-swap-calculation.patch mm-smaps-use-vma-vm_pgoff-directly-when-counting-partial-swap.patch mm-smaps-simplify-shmem-handling-of-pte-holes.patch mm-shmem-unconditionally-set-pte-dirty-in-mfill_atomic_install_pte.patch mm-clear-vmf-pte-after-pte_unmap_same-returns.patch mm-drop-first_index-last_index-in-zap_details.patch mm-add-zap_skip_check_mapping-helper.patch