From patchwork Thu Jun 6 06:32:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13687870 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30F0E101CE; Thu, 6 Jun 2024 06:36:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717655789; cv=none; b=CjphzaGJUbE8CtCSbF8tBD0XRodPvqHgpkrLj6Ha8185xOVXekjBOyMOd36J3qBaX/o7FFFCJp9fPdVcaJ3IOFsODou6gZui5gTwjxneOmsg64pYN+PYO+yZoJYtyAg4Wkv1XcjD75AmlbML+XacLsykI2LIreq73ND4K+BiXlM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717655789; c=relaxed/simple; bh=H+ROwO0chqPlRn6Si/4Oz4F0SzdC7g4y+tLqpdk/xjY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=g0Ht5zgSE9siDyTjK5M2Lw4o9Q9kNTANXClxrby+Z0/MmWRDJlYXi7QvyBul5gSeSzGOHEcYNm7WJJoWYbGjqo4wZA9bgR0L6LV2bgVCND9WxX81HdRtiJPReHJUdvyxai6RPPapjaQMmHB0uUZOkAtXzy6xs3GmxuAAhg6i9CU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VvvdP3QSNzsT8m; Thu, 6 Jun 2024 14:32:25 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 26D9F180085; Thu, 6 Jun 2024 14:36:23 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 6 Jun 2024 14:36:22 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH v2 01/13] mm/memory-failure: simplify put_ref_page() Date: Thu, 6 Jun 2024 14:32:35 +0800 Message-ID: <20240606063247.712575-2-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240606063247.712575-1-linmiaohe@huawei.com> References: <20240606063247.712575-1-linmiaohe@huawei.com> Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) Remove unneeded page != NULL check. pfn_to_page() won't return NULL. No functional change intended. Signed-off-by: Miaohe Lin --- mm/memory-failure.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index f679b579d45d..2e6038c73119 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2120,14 +2120,10 @@ static inline unsigned long folio_free_raw_hwp(struct folio *folio, bool flag) /* Drop the extra refcount in case we come from madvise() */ static void put_ref_page(unsigned long pfn, int flags) { - struct page *page; - if (!(flags & MF_COUNT_INCREASED)) return; - page = pfn_to_page(pfn); - if (page) - put_page(page); + put_page(pfn_to_page(pfn)); } static int memory_failure_dev_pagemap(unsigned long pfn, int flags,