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=-2.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 CDCA0C433E0 for ; Fri, 12 Jun 2020 19:53:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 91F2B20723 for ; Fri, 12 Jun 2020 19:53:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="k/lNNGBh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 91F2B20723 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 27FA58D00D3; Fri, 12 Jun 2020 15:53:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 22EE38D00A0; Fri, 12 Jun 2020 15:53:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 16BA98D00D3; Fri, 12 Jun 2020 15:53:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id F24648D00A0 for ; Fri, 12 Jun 2020 15:53:31 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B3CFA181ABE8F for ; Fri, 12 Jun 2020 19:53:31 +0000 (UTC) X-FDA: 76921609422.02.soup28_39043b426ddf Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 8F7D41FF1E for ; Fri, 12 Jun 2020 19:53:31 +0000 (UTC) X-HE-Tag: soup28_39043b426ddf X-Filterd-Recvd-Size: 3845 Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Fri, 12 Jun 2020 19:53:30 +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 ; Fri, 12 Jun 2020 12:52:43 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 12 Jun 2020 12:53:29 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 12 Jun 2020 12:53:29 -0700 Received: from rcampbell-dev.nvidia.com (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 12 Jun 2020 19:53:24 +0000 Subject: Re: [PATCH] mm/hmm: remove redundant check non_swap_entry() To: Jason Gunthorpe , Matthew Wilcox CC: , , Jerome Glisse , John Hubbard , Christoph Hellwig , Andrew Morton References: <20200612192618.32579-1-rcampbell@nvidia.com> <20200612193524.GL8681@bombadil.infradead.org> <20200612194204.GM65026@mellanox.com> X-Nvconfidentiality: public From: Ralph Campbell Message-ID: <266b26e6-5f6f-9178-948a-fcae20c16112@nvidia.com> Date: Fri, 12 Jun 2020 12:53:23 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200612194204.GM65026@mellanox.com> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1591991563; bh=0OEkAeXHnbstwmHFscadQ/FCSGGM9Wj3sCp54HXFs6I=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=k/lNNGBhXbpnc/5LBW1zGsU34nc7RmLXWFZejYx0xWvEQF9ZdSHov3/InpXaFzjHK Z+oDt/5EzD85bXWjufFCsNzX/ZAgEO0ade0BuIM4lqd2zlJKYWt/AbPROOfej+VGAK rzXTgyvseFAbiJ856edQE6+0/Ahe5rsTTpBKHnDmwwDt9k5CeBsE40u/qXPN18IG9s JdGJ0Pqb0PXe9cKHu1rNYrsW0KdXSQCCFDnYRoQAa817jvQ0qzQv1FAPWiPI4ZhW/G xkgjYmkIBsC8FzCf3vykZwO7EYaczu+wTK4tVXo5CSzwHg9kZVRt0FXJGhYlfWuXyj FaT2BTy0rGTyQ== X-Rspamd-Queue-Id: 8F7D41FF1E X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 6/12/20 12:42 PM, Jason Gunthorpe wrote: > On Fri, Jun 12, 2020 at 12:35:24PM -0700, Matthew Wilcox wrote: >> On Fri, Jun 12, 2020 at 12:26:18PM -0700, Ralph Campbell wrote: >>> In zap_pte_range(), the check for non_swap_entry() and >>> is_device_private_entry() is redundant since the latter is a subset of the >>> former. Remove the redundant check to simplify the code and for clarity. >> >> That is highly configuration dependent. >> >> #else /* CONFIG_DEVICE_PRIVATE */ >> ... >> static inline bool is_device_private_entry(swp_entry_t entry) >> { >> return false; >> } > > The commit message might be a bit confusing, as it is not a subset, I > would say that device_private_entry alone is sufficient to tell if the > entry is private or not. > > For the !CONFIG_DEVICE_PRIVATE case having it wired to false is > right. > > Jason > How about the following message instead? 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.