Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp725512ybg; Fri, 12 Jun 2020 12:57:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjowBnmwtFfjtrxHVZ5ojNEj641SeM9fg69ZeJE5zruKGwiQMSQL0K9+B9PyCZ37zgdAi8 X-Received: by 2002:aa7:dace:: with SMTP id x14mr13367616eds.343.1591991868686; Fri, 12 Jun 2020 12:57:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591991868; cv=none; d=google.com; s=arc-20160816; b=xVH2nbSX0N2yvhXj53pZDYXo2U3y+5XLJAOJs69oOGiO1K9fcCeQ59OR1QalSFqxe6 H+wTv1oo2JWWthj03UfRy8HFJ496b0jdGyp0izPZy55vREt5cg15qKacHw53lk9yHYwY sF97RCxxo0hROoI3407u4w50wwxgiWTjKamrYkemf6wDob2jlajytVld3sHhWmGnzFW5 cNWVm15MtJjuYDFKQ5rWV/rR7JErlBchUir+fH6AsDSIFl8NxWcvX+y8oUCzNUOVYJL0 ZifS7hyJXgkeJYgvE1AaePVGVGTLA3K3OrtRJl4Jx6oRVPToYCSwiBQuN1mAAddJEnHG SjWQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=0OEkAeXHnbstwmHFscadQ/FCSGGM9Wj3sCp54HXFs6I=; b=atseiemM+g/XNCKc5ortf92xo0ppPXD+fT1j4RZJeCUyIhodWw9ziM/tbaWa3EZ84n PkJJWfFpDbMowOJqvXmRZdHmWFRm3dy6R9pPqo7uYz0WN0VTmpBjivXyVy9Ar2EjMzbA YlAZnGu/dadyMSh0N4aDe1W0IcYg2NNbcQxxUnfu5vv2srtHT5PtNXIz1+U15W6uHs2+ 183jnXchGbUznJd+RausOFS0pkKCAq/tkYhGDoofoZTUmdgk2Mvh3YILztbcyDw94BhV Ivma7TMvFhrJT3j28udV4RQ1i0nI5NnlqgDrAlky8Q62IkG1YvYNJ1gpJ9llbNbeKP8Z 91hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="k/lNNGBh"; 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 r25si3951491edq.98.2020.06.12.12.57.26; Fri, 12 Jun 2020 12:57:48 -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="k/lNNGBh"; 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 S1726314AbgFLTxa (ORCPT + 99 others); Fri, 12 Jun 2020 15:53:30 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:13675 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726268AbgFLTxa (ORCPT ); Fri, 12 Jun 2020 15:53:30 -0400 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== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.