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: 13687855 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 4FCC5C25B75 for ; Thu, 6 Jun 2024 06:36:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E8336B009B; Thu, 6 Jun 2024 02:36:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 695E46B00A0; Thu, 6 Jun 2024 02:36:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E8AB6B009B; Thu, 6 Jun 2024 02:36:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E595F6B009E for ; Thu, 6 Jun 2024 02:36:29 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 70992A1332 for ; Thu, 6 Jun 2024 06:36:29 +0000 (UTC) X-FDA: 82199504898.27.838FEAA Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf04.hostedemail.com (Postfix) with ESMTP id 4AD224000A for ; Thu, 6 Jun 2024 06:36:26 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717655787; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h5v248dKscUzY2hnQdiMAKgssiOpynXDkWMMYLsa818=; b=W+7LXwTDiGUilHmFUIGzsle0jOHi6iWHEjf5FSGhifmli8VMUEiZfMDZQ3DTvGt3OogWxo K5eUVdpJSx8HqaCzCrGRit+iJ/5AI3Z7a+hAbcDrVERLngfoXWXZMUUItmbZV87azNAZJE vtSL+iLdFu153AtyAXdM3pbCqkm3rmg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717655787; a=rsa-sha256; cv=none; b=z1dGndSW7gPOOdrplHB/d+sVaatnzfhWaLsSvcf9PjyhehyKaOpUyj62044rRUE5uJI3wX IdXvnbw8RBKF3qtjsdjC43UuLLmpCbC0nF72XdJtM36VnVWfQlhBbP9DfE8NzjHSMzPn45 aqbSgt/I55PGgKzKELv5C4it2GgEEaA= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=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> MIME-Version: 1.0 X-Originating-IP: [10.173.135.154] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-Rspam-User: X-Stat-Signature: nkpfiba3t7tre8u7p6kzsdu5orrg4y4r X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 4AD224000A X-HE-Tag: 1717655786-377904 X-HE-Meta: U2FsdGVkX193EHt/5GiZ9YQT5PAbzJ+9ba7mTrGjHSHVlrVdWp0cuZZP6bknUiw77eP4PP2f2euspZwfjOeItzidOvpohmsZHMl5Tvkygf5WoptnTLdyaT9ONTvD32b++m9BFDqXauhESZarunyqcFsYZMjkzxziDIjZw8zJmVkKmma0buDpr5qplztOuO+c8zlFVS80smouh0McMclwcD+Zr2OAd9k+ca0UOxZI6bOFH8hTgT1vdZ2t1eaZewh3fKlRb/6eAFJR/k+k1u9kswl7DdhkQQA0SdEH9I9MfSNhHmVXKzQ0FzPkfXt0g1D64UfDI2YnA6OHwAkd+hCmX8GV5GPnBDlWgvo4eDTY8q1BvTO8TAbSLSFes3RsBxMVqPRJ3QcVbNT+lME76FmbUnTwYCy206YmOXgTTgcuz+dIbNZ6XuCzpSRH8O/fo5PGui9rLkvVTfemkuLdULYrKrnkcO8omFuY858V2k+E4OCIE/N5e+g/Welab8CFAL/f/6oZ/NzqWs7lrpXqzsLGzXBICku6aFjeGLAPnzpDv26DQSQub/i5qXkgunL9C8lIJBh8GLXQQXEiNJF+wyrYeHLcZ1R1tW0tA1B1l8oFVGSI0iCG+LSVolyQFGbVkS8MJdeIY8JRQM/eCNlfxq71zTLe5u0IKtFBfnFYjOKAyLVTQ16XvJGpzBcuBUbsDECXrIZNBzsnKXwEAr61UDx53DUove1Bh7cef6dbuNdC9g3KvOqDfRD+9IrOmdlJsdl3wkhfXbGJPh8fHt/5x2Gz9GVWM+RLQUk1wY6dlTHbIp49CVhtkabRlPAVJjqba/I0xFnl0M+x98VUd6naUAjdokjj3h+tr5o7EScL1D5XCouFH4woU+7jgLEA8fLUyVX8FpbPXdQnmRQwT1EhA1QibVRVNvQXL8nCm2SnD29lE2ZVFRQjG6hJZ+X23dJ4BVLLSV9CMoqzsCDGQVtNYmi 6beXyZou PB5Ci02+uKlq6Glwm12JoYJKhmHko77K6Yd3l4yh2tUfpyagWllDRIV2ti5Z32oaEUMHpZCVdv4nDSd81r9PtTE3HdeWJsOeNYPf0A+dSuGTwlqFkLwTQsuJyDeanUwPZgxzxTkXZu6PZsmf4sp3L6GHlEBYTY61a29xqk3YFNSQh7WNuvUxCYz5Lem2jVh0XoiZXn/pR7e2lCgUZJPirAkCpyogtbH3CiP7FDrMj/yOA6gIk/q+LwvjCFvMNx50vn1JAw53vlw6CwwM= 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: List-Subscribe: List-Unsubscribe: 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,