From patchwork Mon Jun 15 17:54:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralph Campbell X-Patchwork-Id: 11605473 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A57D60D for ; Mon, 15 Jun 2020 17:54:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B7BD920882 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 B7BD920882 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) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CA9DE6B0008; Mon, 15 Jun 2020 13:54:26 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org 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-Original-To: linux-mm@kvack.org 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-Spam-Summary: 1,0,0,,d41d8cd98f00b204,rcampbell@nvidia.com,,RULES_HIT:30012:30054:30064:30070:30074,0,RBL:216.228.121.143:@nvidia.com:.lbl8.mailshell.net-64.10.201.10 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:36,LUA_SUMMARY:none 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 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 Acked-by: David Hildenbrand --- 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, } entry = pte_to_swp_entry(ptent); - if (non_swap_entry(entry) && is_device_private_entry(entry)) { + if (is_device_private_entry(entry)) { struct page *page = device_private_entry_to_page(entry); if (unlikely(details && details->check_mapping)) {