From patchwork Tue Mar 22 21:48:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12789297 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29C03C433EF for ; Tue, 22 Mar 2022 21:49:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB3B86B0213; Tue, 22 Mar 2022 17:49:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A61CF6B0246; Tue, 22 Mar 2022 17:49:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83DE86B0248; Tue, 22 Mar 2022 17:49:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0024.hostedemail.com [216.40.44.24]) by kanga.kvack.org (Postfix) with ESMTP id 7215E6B0213 for ; Tue, 22 Mar 2022 17:49:27 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 40E20A4DD9 for ; Tue, 22 Mar 2022 21:49:27 +0000 (UTC) X-FDA: 79273363974.22.F801C68 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf07.hostedemail.com (Postfix) with ESMTP id 3D1BC4001E for ; Tue, 22 Mar 2022 21:48:46 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 29E8DB81D59; Tue, 22 Mar 2022 21:48:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD6A9C340EC; Tue, 22 Mar 2022 21:48:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1647985724; bh=mUuROq10ahLPR03SHPG1MdCOWBxv+599rSB3EdvybYM=; h=Date:To:From:In-Reply-To:Subject:From; b=lKyB3klfkRYBZsMx+kfzEWYz1fAOXkpTXebbCnMOSwo8Jx9TH/dONH3VWnAkXwPe+ R2zuCsNhgJOSLNpFeSb2eXQlbVbb6d/2+kD2+C7W6+N19YiPRzVJ/oHyXjRAHYFv0B J3ChoBMbZU4J04CKaH+UFZ303yfDkgAYeuqdsuJQ= Date: Tue, 22 Mar 2022 14:48:43 -0700 To: sj@kernel.org,rientjes@google.com,linmiaohe@huawei.com,jrdr.linux@gmail.com,dan.carpenter@oracle.com,baolin.wang@linux.alibaba.com,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220322143803.04a5e59a07e48284f196a2f9@linux-foundation.org> Subject: [patch 201/227] mm/damon: remove redundant page validation Message-Id: <20220322214843.DD6A9C340EC@smtp.kernel.org> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 3D1BC4001E X-Stat-Signature: 1d8c5kppmu954qmq1e6f4szefnccee55 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=lKyB3klf; dmarc=none; spf=pass (imf07.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspam-User: X-HE-Tag: 1647985726-559716 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: From: Baolin Wang Subject: mm/damon: remove redundant page validation It will never get a NULL page by pte_page() as discussed in thread [1], thus remove the redundant page validation to fix below Smatch static checker warning. mm/damon/vaddr.c:405 damon_hugetlb_mkold() warn: 'page' can't be NULL. [1] https://lore.kernel.org/linux-mm/20220106091200.GA14564@kili/ Link: https://lkml.kernel.org/r/6d32f7d201b8970d53f51b6c5717d472aed2987c.1642386715.git.baolin.wang@linux.alibaba.com Signed-off-by: Baolin Wang Reported-by: Dan Carpenter Reviewed-by: SeongJae Park Acked-by: David Rientjes Acked-by: Souptick Joarder Reviewed-by: Miaohe Lin Signed-off-by: Andrew Morton --- mm/damon/vaddr.c | 6 ------ 1 file changed, 6 deletions(-) --- a/mm/damon/vaddr.c~mm-damon-remove-redundant-page-validation +++ a/mm/damon/vaddr.c @@ -402,9 +402,6 @@ static void damon_hugetlb_mkold(pte_t *p pte_t entry = huge_ptep_get(pte); struct page *page = pte_page(entry); - if (!page) - return; - get_page(page); if (pte_young(entry)) { @@ -564,9 +561,6 @@ static int damon_young_hugetlb_entry(pte goto out; page = pte_page(entry); - if (!page) - goto out; - get_page(page); if (pte_young(entry) || !page_is_idle(page) ||