From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D218C433EF for ; Fri, 17 Sep 2021 00:30:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B624161019 for ; Fri, 17 Sep 2021 00:30:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B624161019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id EBCAC6B0071; Thu, 16 Sep 2021 20:30:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E6D8B6B0072; Thu, 16 Sep 2021 20:30:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D35996B0073; Thu, 16 Sep 2021 20:30:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0003.hostedemail.com [216.40.44.3]) by kanga.kvack.org (Postfix) with ESMTP id C3C676B0071 for ; Thu, 16 Sep 2021 20:30:02 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 6AEB418473E48 for ; Fri, 17 Sep 2021 00:30:02 +0000 (UTC) X-FDA: 78595183044.34.C4062A1 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 1D953D0000AB for ; Fri, 17 Sep 2021 00:30:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631838601; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=a8+9SVNu2ZHQgtfu6GlimC8OO9mKCwMSWTrH27gnhz0=; b=Cg8imrDUYdeGcIhYKLH31Y9vrwOnbfhIl4QhDoRG+tkwC4yI11kyi7U94K+Gu2rIoAA6Pc 370CNI49NVmxIDcMifAGeQiYnpe1DPqa/jyKMvKkXSktgSLDiIXJ94nzFDxz3FeZPDASaD IICHF6+F3q/vZuXwhKNTiZ2OIO8ovbA= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-298-E-372dDeNzWqrOuDQsBV5g-1; Thu, 16 Sep 2021 20:30:00 -0400 X-MC-Unique: E-372dDeNzWqrOuDQsBV5g-1 Received: by mail-qv1-f72.google.com with SMTP id d2-20020a0caa02000000b003784ba308f1so80249736qvb.9 for ; Thu, 16 Sep 2021 17:30:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=a8+9SVNu2ZHQgtfu6GlimC8OO9mKCwMSWTrH27gnhz0=; b=hDYaDiVVyRfwQ55OFtZ2k61v6yfGRlFJIgFL5G4h2b9oxhOdNb4zZJztPtWU/7GjrV MCDe1HwiOoYVSeTdF/31ck67AL58vLpfnF+a3abfFrQoKDVdSCa03gNglGJvZ6r+/DL+ +9Q27lx/6bJdf1F3j+aB1senqTA2zMHgOB2zw6A8MyPbyjIdzvuAh9m6fVYbctho9Ng4 T9ZizfYCegHQRPOYz8wlSjgYzg0blNw7JQfuDIynT/SDTpDoGBLiOSWZsdAwbIQW5m8S GmcwK3m3XS5fiHxKwgEuY93PWMopBlUOSlVclgHCro9xveftmcHKLZNGEvO75NgBTvSA toIw== X-Gm-Message-State: AOAM532bncPx+s9IJLd8/Sr3TYKtSs748w0sYdTmFe7h6b1hkIcy4OPQ CQcMvq/PKZ8QJOpClTGT5T2uJsluW+yGQOLaT3HqgWO+1ykg/qtPvileM3v6nACtlrs7tqcpCFd zlHoCL84yKIg= X-Received: by 2002:a37:a554:: with SMTP id o81mr7882226qke.231.1631838599985; Thu, 16 Sep 2021 17:29:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyMIOHSqvz3Pg8wA+G8mfHUhJtQN8oib5UDYbn+4kZKz5Vj+nJtVsgnQGqnLvmGQmNxhfgfA== X-Received: by 2002:a37:a554:: with SMTP id o81mr7882208qke.231.1631838599699; Thu, 16 Sep 2021 17:29:59 -0700 (PDT) Received: from t490s ([2607:fea8:56a2:9100::d35a]) by smtp.gmail.com with ESMTPSA id l1sm405907qkj.65.2021.09.16.17.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 17:29:59 -0700 (PDT) Date: Thu, 16 Sep 2021 20:29:57 -0400 From: Peter Xu To: Vlastimil Babka Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Hugh Dickins Subject: Re: [PATCH] mm/smaps: Use vma->vm_pgoff directly when counting partial swap Message-ID: References: <20210916215839.95177-1-peterx@redhat.com> <738511ae-b253-9927-eca1-97d621d9f149@suse.cz> MIME-Version: 1.0 In-Reply-To: <738511ae-b253-9927-eca1-97d621d9f149@suse.cz> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Cg8imrDU; spf=none (imf15.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Stat-Signature: jxe4ta5x4qsfddrot7magjooscsekb5c X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 1D953D0000AB X-HE-Tag: 1631838601-237408 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: 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