Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1516270ybh; Sun, 19 Jul 2020 23:28:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEV4p/TtaYlukcnQsCZSFxS84jdxq22AgcbalSARTUjfeF3OOMgwI77c99bmeoGzw9d9en X-Received: by 2002:aa7:d8ca:: with SMTP id k10mr20263413eds.108.1595226507757; Sun, 19 Jul 2020 23:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595226507; cv=none; d=google.com; s=arc-20160816; b=umtbAXDonUCcDIGmlUjsmhKgiDUZUWMQLYQljaZaTp6h9p+i9QtJ4ijSr8epFhHrih tUm2y72Wfuwp3Zr6A5gsX+xpTwLmALJp3Vvs4rb7SCSrYHW1CupWcM4nZw67lKoDPAmC aepHJ/5KmbmJeKto/Fo9nyAbqc3crrNs9iSHLJQ2soHbjHB2KZzWvZSvf9FSEP9azZi5 q63QLbp6s+rVGu6EMwKK59jnEKug6XOIRWXWQ5P/a2mpOgr1jhF+KmJWPCYd5lX122N8 FAKECW16aaghcf0tfPcdZ42Y8b1OQFFR9hiFmn3smz7U/fn+g2EFhZ0X8Cp75YcQWdFF tJUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=PvPXzl5kZc3bZ9UIjpkbA+aZfXqt5toWfAuiLtxvI/Y=; b=gKLsmowmxOSAiWbjmH9A6iZo90Sj7eUwIvceT8DzWRTve9MLQajP3Vaydm6xrVtI2Z 298mhZr3+JY0iV5bhFMMXlTeqGXvmZonuNuv8FJCQHGHY0pNHJ56CsJ1TonfzhdA9r7F jtBagMjiExXLB4urXFBVWh0y41wOHvcF5OPGXx32xnnY0q7q1zFXDDxgjn6J/hJa1MYj eQ1fSTGFteWiRraiL4b1vxrcalX+JmJA++HVUzLz+CioebNggjUCsqXlllvlSIs2C/Gm M/9W2cyr81d3vvP0Owl7sWSkr0PXyhD4rF7B58lxrFl34IYWLJ1H5mvwrA/9o07hZk2m qScw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gK6pkZdq; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x18si9792156ejb.418.2020.07.19.23.28.05; Sun, 19 Jul 2020 23:28:27 -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=@redhat.com header.s=mimecast20190719 header.b=gK6pkZdq; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727044AbgGTG0l (ORCPT + 99 others); Mon, 20 Jul 2020 02:26:41 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:24817 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725805AbgGTG0i (ORCPT ); Mon, 20 Jul 2020 02:26:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595226397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=PvPXzl5kZc3bZ9UIjpkbA+aZfXqt5toWfAuiLtxvI/Y=; b=gK6pkZdqskB4Y7Qf53ooTR2NdJItpTJFhp5t8qum1StumiFEgHQ0qX1l2AGr/j6v45ngcv Iyj26rCU24bctlhiPm86mWwOPT4yAMURsL0MuHtxMJk13JAXSASzcEM3ehtWkbXkDQWiRd OPQxdnqfQMHHIqnbIU7FjBm6PY1PaYc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-302-ImXG8Ua-Od2kA99iD7syFg-1; Mon, 20 Jul 2020 02:26:35 -0400 X-MC-Unique: ImXG8Ua-Od2kA99iD7syFg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6CA9C80183C; Mon, 20 Jul 2020 06:26:34 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-150.pek2.redhat.com [10.72.12.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8911B7852D; Mon, 20 Jul 2020 06:26:32 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, mike.kravetz@oracle.com, akpm@linux-foundation.org, bhe@redhat.com Subject: [PATCH 3/5] mm/hugetlb.c: Remove the unnecessary non_swap_entry() Date: Mon, 20 Jul 2020 14:26:21 +0800 Message-Id: <20200720062623.13135-4-bhe@redhat.com> In-Reply-To: <20200720062623.13135-1-bhe@redhat.com> References: <20200720062623.13135-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The checking is_migration_entry() and is_hwpoison_entry() are stricter than non_swap_entry(), means they have covered the conditional check which non_swap_entry() is doing. Hence remove the unnecessary non_swap_entry() in is_hugetlb_entry_migration() and is_hugetlb_entry_hwpoisoned() to simplify code. Signed-off-by: Baoquan He --- mm/hugetlb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index a58f976a9dd9..467894d8332a 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3748,7 +3748,7 @@ bool is_hugetlb_entry_migration(pte_t pte) if (huge_pte_none(pte) || pte_present(pte)) return false; swp = pte_to_swp_entry(pte); - if (non_swap_entry(swp) && is_migration_entry(swp)) + if (is_migration_entry(swp)) return true; else return false; @@ -3761,7 +3761,7 @@ static bool is_hugetlb_entry_hwpoisoned(pte_t pte) if (huge_pte_none(pte) || pte_present(pte)) return false; swp = pte_to_swp_entry(pte); - if (non_swap_entry(swp) && is_hwpoison_entry(swp)) + if (is_hwpoison_entry(swp)) return true; else return false; -- 2.17.2