From patchwork Mon Aug 31 21:22:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralph Campbell X-Patchwork-Id: 11747055 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 BC1ED13B1 for ; Mon, 31 Aug 2020 21:22:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7CC4C20866 for ; Mon, 31 Aug 2020 21:22:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="RCXCvDYm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CC4C20866 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 8A1B76B0003; Mon, 31 Aug 2020 17:22:32 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 852826B0037; Mon, 31 Aug 2020 17:22:32 -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 719E76B005A; Mon, 31 Aug 2020 17:22:32 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0129.hostedemail.com [216.40.44.129]) by kanga.kvack.org (Postfix) with ESMTP id 5A61E6B0003 for ; Mon, 31 Aug 2020 17:22:32 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 276F9181AEF15 for ; Mon, 31 Aug 2020 21:22:32 +0000 (UTC) X-FDA: 77212137744.03.play98_180d62927092 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id F16E728A4E8 for ; Mon, 31 Aug 2020 21:22:31 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,rcampbell@nvidia.com,,RULES_HIT:30012:30054:30064:30070,0,RBL:216.228.121.64:@nvidia.com:.lbl8.mailshell.net-62.18.0.100 64.10.201.10;04y84n3dg9tzh36r7odqozrttk7ogoczduier466tb3pwutrnefc8g1tcqdktd6.7yo4bo4emxiohdhuckw8ypihj81ca4bzbj847qtfuu5ofqt6fw7jw88io4fih7o.q-lbl8.mailshell.net-223.238.255.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:24,LUA_SUMMARY:none X-HE-Tag: play98_180d62927092 X-Filterd-Recvd-Size: 3932 Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Mon, 31 Aug 2020 21:22:31 +0000 (UTC) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 31 Aug 2020 14:21:44 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 31 Aug 2020 14:22:30 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 31 Aug 2020 14:22:30 -0700 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 31 Aug 2020 21:22:30 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 31 Aug 2020 21:22:29 +0000 Received: from rcampbell-dev.nvidia.com (Not Verified[10.110.48.66]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 31 Aug 2020 14:22:29 -0700 From: Ralph Campbell To: , CC: Jerome Glisse , Alistair Popple , Christoph Hellwig , Jason Gunthorpe , Bharata B Rao , Andrew Morton , Ralph Campbell Subject: [PATCH 1/2] mm/migrate: remove unnecessary is_zone_device_page() check Date: Mon, 31 Aug 2020 14:22:21 -0700 Message-ID: <20200831212222.22409-2-rcampbell@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200831212222.22409-1-rcampbell@nvidia.com> References: <20200831212222.22409-1-rcampbell@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1598908904; bh=lW7r6oHxQx8fXPiNLSVPMYvMf7jRKDuGDFS9fvpd+DY=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:X-NVConfidentiality: Content-Transfer-Encoding:Content-Type; b=RCXCvDYm0RJCr4PbsQ4jczkmiYom2pXKkeuFLr7jI2ZGyYfnrBqoUKKFa31P6/Xqx xSGgf91mH84s5YEq4LZ7nJgco6/NQmUy8pSOXEGvWhw3rMI1iyYmZXKruVg4r5NyIh WvavOoGvUcEiznRjju0C9EV6DbO5Hdu6MKCMjQgvK/eoEzb/TmLOnWVuQsCdP6+BI3 LQvtrOPuy3Fy/ddwCOMNbnha0bZAciuV1aMXLQrTGmdHy9+Bt+g1FioFzMMQZvSqbG BJdR40k7XOhMgtiFbWQDFLhsnDgvjgUKv4DgvbgsvRKFU2ZRgYB16mfNK1oh3mCsz2 er1+iG7ebGZ/w== X-Rspamd-Queue-Id: F16E728A4E8 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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: The check for is_zone_device_page() and is_device_private_page() is unnecessary since the latter is sufficient to determine if the page is a device private page. Simplify the code for easier reading. Signed-off-by: Ralph Campbell Reviewed-by: Christoph Hellwig --- mm/migrate.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 659d3d8a3e1f..fe339a847328 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -246,13 +246,11 @@ static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma, else if (pte_swp_uffd_wp(*pvmw.pte)) pte = pte_mkuffd_wp(pte); - if (unlikely(is_zone_device_page(new))) { - if (is_device_private_page(new)) { - entry = make_device_private_entry(new, pte_write(pte)); - pte = swp_entry_to_pte(entry); - if (pte_swp_uffd_wp(*pvmw.pte)) - pte = pte_swp_mkuffd_wp(pte); - } + if (unlikely(is_device_private_page(new))) { + entry = make_device_private_entry(new, pte_write(pte)); + pte = swp_entry_to_pte(entry); + if (pte_swp_uffd_wp(*pvmw.pte)) + pte = pte_swp_mkuffd_wp(pte); } #ifdef CONFIG_HUGETLB_PAGE