Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1847959ybt; Mon, 15 Jun 2020 10:57:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2HfWgCPjSszhTGmoW+fSDb36VxKYaj8eBNZeTA9Ayi6GTlHy7w3zoHF6MXu9f9Yt7DWgW X-Received: by 2002:a17:906:695a:: with SMTP id c26mr27632528ejs.214.1592243823739; Mon, 15 Jun 2020 10:57:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592243823; cv=none; d=google.com; s=arc-20160816; b=yg9W2c3l1+ixeVrNGHp+YSL9czrsTdXZwT+qaIAC4E/Lzw8lz9ag+0lhD/C5p1hgqm 5t3L7+RiVms6/n1R6n/eJoHUgCRsXjFXexd7OGF7LkHbuN3e6TPoLIWNLXJEQNML8BPf MhzeMaItPEKzGKfGrnpSKdXbm4gDnkzZvF6Ea6OgKkFiKpH8+JrG5OYTfy+IAyCYca/j JazQfTxNCLnkCsD9+ZUWpZ/3mqP60Rs9NRYcxHtxukYw9u+2nRufPUcD+RzRMVhC+tdw v8LC/6OCQmX0PeVPYQlWkcU/Xipz2pEB+NmBYn1Kxt4ThnTeQzcrjA5HPJvpTYK1XBgP 5Omg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=qWTe+BLtXodTED42yP557c7MsRwVgv/ifpBvIWjWzJQ=; b=VYMIV/O8wi5W27cVvZc0yHDbNOqTaduTJxQ7rsrXLUiL3/lY+XWIzt4whFnGvrNVdw p9FPSF3E3bD8Iys2VrNeIIp9OPDh3BPiQVBM+DVWKkO2K6igcDtNc3K7Hrw91JWm16/z QJPPvSfkIi6Hqu6TKAUftyypdl1eDLy2sCf7u4nCaMYfINXK/fX0b2nxoUDHLxVJI/mH 9gP26lZwd2Fz5wmn7IzWfO8s4TFF/K50zLxFywXeXeWANCDQRH1Aa3SYwRVUazzJ3lrD 55p3UERBm32HXXLEahJHC9M6Zt2cro+dJSJB4X5qINpbU214qe1+FS+x7qad2AVoOXf5 8H6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=IS40y5XH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de16si8365464edb.30.2020.06.15.10.56.39; Mon, 15 Jun 2020 10:57:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=IS40y5XH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731167AbgFORyY (ORCPT + 99 others); Mon, 15 Jun 2020 13:54:24 -0400 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:7637 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729124AbgFORyY (ORCPT ); Mon, 15 Jun 2020 13:54:24 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 15 Jun 2020 10:52:46 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 15 Jun 2020 10:54:23 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 15 Jun 2020 10:54:23 -0700 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 15 Jun 2020 17:54:16 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 15 Jun 2020 17:54:16 +0000 Received: from rcampbell-dev.nvidia.com (Not Verified[10.110.48.66]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 15 Jun 2020 10:54:16 -0700 From: Ralph Campbell To: , CC: Jerome Glisse , John Hubbard , Christoph Hellwig , Jason Gunthorpe , "Andrew Morton" , Ralph Campbell Subject: [PATCH v2] mm: remove redundant check non_swap_entry() Date: Mon, 15 Jun 2020 10:54:05 -0700 Message-ID: <20200615175405.4613-1-rcampbell@nvidia.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: quoted-printable Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1592243566; bh=qWTe+BLtXodTED42yP557c7MsRwVgv/ifpBvIWjWzJQ=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:X-NVConfidentiality:Content-Transfer-Encoding: Content-Type; b=IS40y5XH4s+AGuGn8++rlbYgNlNhfC5dCODeMm1vcWE+JY/mdPQHnyPga0gGHCqRt NavVvoSCSy0MT7EXVeJXXIU5TUbc9DrVEwcv+CbrIu/fbC7vqiH7Fw2SQ0znSEHwiM GfVqls1cH8mXwW8QIyFacWYeSr5v+ROnA0M+dtZPAbY1z/JDouTmWa/8/dRlTlFruS 6BgP368BPNQcrR91Tiwg+TdiLkDsls2wLK51/sBfgyBLkSflIDM5qdDeKLxwlY55Qc piG2Dd8E7feLFTkE2so1lqTroIOqfeXJZViu4om8qhDxgq3kKfa3XO45xAxGqUeusl ihqwJxz9ptxTw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In zap_pte_range(), the check for non_swap_entry() and is_device_private_entry() is unnecessary since the latter is sufficient to determine if the page is a device private page. Remove the test for non_swap_entry() to simplify the code and for clarity. Signed-off-by: Ralph Campbell Reviewed-by: Jason Gunthorpe --- This is based on the linux 5.8.0-rc1 tree and is intended for Andrew's mm tree. There is no rush so it could go into 5.9 but I think it is safe enough to go into an rc after the patch is reviewed. Changes since v1: Updated the change log to be more clear. Added Jason Gunthorpe's reviewed-by. Rebased to 5.8.0-rc1 mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index dc7f3543b1fd..bdbb4f97e7d0 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1098,7 +1098,7 @@ static unsigned long zap_pte_range(struct mmu_gather = *tlb, } =20 entry =3D pte_to_swp_entry(ptent); - if (non_swap_entry(entry) && is_device_private_entry(entry)) { + if (is_device_private_entry(entry)) { struct page *page =3D device_private_entry_to_page(entry); =20 if (unlikely(details && details->check_mapping)) { --=20 2.20.1