From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) (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 D55E118EA1; Fri, 7 Jun 2024 03:28:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.35 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717730926; cv=none; b=OMoun4TvyACSXsz+9UkWP2zApR3xQbW2m+EREPgyw0JjUwccxLzYtO61o5WPY3gzuZFwxlrbFf/NPMFOI0H3IFkTHmq4ax/+tPJxY8ZRGBp7x7/5wwShcWF1xLnEqJWXbeTN6mIi/GBb5v23zm6+c0R5igi0HoLzdFzBSC0gtEE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717730926; c=relaxed/simple; bh=9ZSuRFiMb1/P9aDDtFCe5uTcEsGSZdC6VtpLYJaJU6w=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=WE+UxZkKtwsAnxrrzYxoOdDHa+1tRHynxuAWsldYJoufOGGgG3gxb3t8gQlwzTWMwl/2WH/3bzex6eMQOWeZ69GS5DlcXdMvsIk0x3gDRbTz9kcdpxqKGun0j7LKGu1nUoN/Q9FBUE+wqe433T7qFmjrhpvDDfpidnp4zuIg9AU= 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.35 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.88.234]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4VwRQc55Kpz1S5ky; Fri, 7 Jun 2024 11:24:56 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id ED3F41402CB; Fri, 7 Jun 2024 11:28:39 +0800 (CST) Received: from [10.173.135.154] (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; Fri, 7 Jun 2024 11:28:39 +0800 Subject: Re: [PATCH v2 01/13] mm/memory-failure: simplify put_ref_page() To: Kefeng Wang CC: , , , , , , References: <20240606063247.712575-1-linmiaohe@huawei.com> <20240606063247.712575-2-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: Date: Fri, 7 Jun 2024 11:28:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) On 2024/6/6 14:46, Kefeng Wang wrote: > > > On 2024/6/6 14:32, Miaohe Lin wrote: >> 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) > > Since all calllers have a valid page,better to pass the page instead of pfn? Seems not. put_ref_page() called above memory_failure_dev_pagemap() seems don't have a valid page yet. Also page might be NULL when calling put_ref_page() in soft_offline_page(). So it should be better to still pass pfn. Or am I miss something? Thanks. .