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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 82556C433E1 for ; Mon, 15 Jun 2020 17:54:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4942020810 for ; Mon, 15 Jun 2020 17:54:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="IS40y5XH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4942020810 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CF8B76B0007; Mon, 15 Jun 2020 13:54:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CA9DE6B0008; Mon, 15 Jun 2020 13:54:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE7376B000C; Mon, 15 Jun 2020 13:54:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0033.hostedemail.com [216.40.44.33]) by kanga.kvack.org (Postfix) with ESMTP id AAD506B0007 for ; Mon, 15 Jun 2020 13:54:26 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 51223824556B for ; Mon, 15 Jun 2020 17:54:26 +0000 (UTC) X-FDA: 76932195732.06.war40_4d14c2426df8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id DABE3101CC25E for ; Mon, 15 Jun 2020 17:54:25 +0000 (UTC) X-HE-Tag: war40_4d14c2426df8 X-Filterd-Recvd-Size: 3791 Received: from hqnvemgate24.nvidia.com (hqnvemgate24.nvidia.com [216.228.121.143]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Mon, 15 Jun 2020 17:54:24 +0000 (UTC) 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== X-Rspamd-Queue-Id: DABE3101CC25E X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: 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