From patchwork Fri Nov 5 20:36:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12605419 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF33EC433F5 for ; Fri, 5 Nov 2021 20:36:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9B6EB61242 for ; Fri, 5 Nov 2021 20:36:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9B6EB61242 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3792E94001C; Fri, 5 Nov 2021 16:36:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 350D0940007; Fri, 5 Nov 2021 16:36:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 219C194001C; Fri, 5 Nov 2021 16:36:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0098.hostedemail.com [216.40.44.98]) by kanga.kvack.org (Postfix) with ESMTP id 0D725940007 for ; Fri, 5 Nov 2021 16:36:05 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id BFD9E70737 for ; Fri, 5 Nov 2021 20:36:04 +0000 (UTC) X-FDA: 78776033490.01.0F94E62 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf04.hostedemail.com (Postfix) with ESMTP id BA2275000300 for ; Fri, 5 Nov 2021 20:35:55 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 5685F611C0; Fri, 5 Nov 2021 20:36:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1636144563; bh=wkTASAhiipzxDonZhbRjk6v7zkBquZBk9Uduri6FL+Q=; h=Date:From:To:Subject:In-Reply-To:From; b=Ss7q6Nfj1FVdCH3Xj99rcQ4c2NVRBN8LeE0X3a0Vu3ttpk/qngLiYDRcXN20GnpRL xUnVY+wOUdoO0HP1P0EYgZOnsQLym65WL7q+IEPRNpSk6x2HabFdS/k1snC+FG9rvn Fa4S86W741MJJDQ6dvHWBHj8TO1A+hGS4OszvkPE= Date: Fri, 05 Nov 2021 13:36:02 -0700 From: Andrew Morton To: aarcange@redhat.com, akpm@linux-foundation.org, hughd@google.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, peterx@redhat.com, torvalds@linux-foundation.org, vbabka@suse.cz, willy@infradead.org Subject: [patch 028/262] mm/smaps: use vma->vm_pgoff directly when counting partial swap Message-ID: <20211105203602.PAtMTScF1%akpm@linux-foundation.org> In-Reply-To: <20211105133408.cccbb98b71a77d5e8430aba1@linux-foundation.org> User-Agent: s-nail v14.8.16 Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=Ss7q6Nfj; dmarc=none; spf=pass (imf04.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: BA2275000300 X-Stat-Signature: wub8nxbgdzyr4wkenaftpf9cybs53k8x X-HE-Tag: 1636144555-285326 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Peter Xu 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@redhat.com Signed-off-by: Peter Xu Reviewed-by: Vlastimil Babka Cc: Hugh Dickins Cc: Andrea Arcangeli Cc: Matthew Wilcox Signed-off-by: Andrew Morton --- 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)); } /*