From mboxrd@z Thu Jan 1 00:00:00 1970 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 C0EAEC43334 for ; Mon, 27 Jun 2022 09:03:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A6A46B0071; Mon, 27 Jun 2022 05:03:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 356868E0002; Mon, 27 Jun 2022 05:03:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21DF18E0001; Mon, 27 Jun 2022 05:03:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 120226B0071 for ; Mon, 27 Jun 2022 05:03:29 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id DADA960EAA for ; Mon, 27 Jun 2022 09:03:28 +0000 (UTC) X-FDA: 79623427296.10.E000F7A Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf27.hostedemail.com (Postfix) with ESMTP id C8C3440037 for ; Mon, 27 Jun 2022 09:03:27 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LWhYm2R5szkWjZ; Mon, 27 Jun 2022 17:02:04 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 27 Jun 2022 17:02:47 +0800 Subject: Re: [PATCH v2 7/9] mm, hwpoison: make __page_handle_poison returns int To: Naoya Horiguchi , CC: Andrew Morton , David Hildenbrand , Mike Kravetz , Liu Shixin , Yang Shi , Oscar Salvador , Muchun Song , Naoya Horiguchi , References: <20220623235153.2623702-1-naoya.horiguchi@linux.dev> <20220623235153.2623702-8-naoya.horiguchi@linux.dev> From: Miaohe Lin Message-ID: Date: Mon, 27 Jun 2022 17:02:47 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20220623235153.2623702-8-naoya.horiguchi@linux.dev> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656320608; a=rsa-sha256; cv=none; b=73A9UnYHTGBfbQ56O6vFYzYhKXDfc3YKfe/KKouqrz/xsnFUZnXT41l/wOD6XrYSo0LL2R 65QkHBEfCcX8+A3bMCYU618aV/nyn1guq9oVmuElq/L4fKLyyL+0Y+1GXu0vDuVxy1Lfro 2MJYT+AavOkWbh2W1lBIO6opjzFzakM= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; spf=pass (imf27.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=1656320608; 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=jNtKHfCIFDG5NQbhgKRV2iQxxZZlI4uy5u6ytvCyAsY=; b=6E4ArdhnqiCJWMGY0X2aWismAiKPfjem7Whe8pHUYm4b7dG+40nETbsjM5H/IG9I+rp55f pcK1X3DT7NwdoULSUmJrb8H+WZiLhQAP9CiCBANb3r4vwc59y0vkhQMO0mh/Fa3xbJaKiC /GYvKlxNVeCr/+T8NEih/YSMG/KE93s= X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: C8C3440037 Authentication-Results: imf27.hostedemail.com; dkim=none; spf=pass (imf27.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 X-Rspam-User: X-Stat-Signature: 3jmn9gkd4ak6ehxtpya84hmg5pi7g7hq X-HE-Tag: 1656320607-877522 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: On 2022/6/24 7:51, Naoya Horiguchi wrote: > From: Naoya Horiguchi > > __page_handle_poison() returns bool that shows whether > take_page_off_buddy() has passed or not now. But we will want to > distinguish another case of "dissolve has passed but taking off failed" > by its return value. So change the type of the return value. > No functional change. > > Signed-off-by: Naoya Horiguchi > --- > mm/memory-failure.c | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index ce045d0d6115..db85f644a1e3 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -71,7 +71,13 @@ atomic_long_t num_poisoned_pages __read_mostly = ATOMIC_LONG_INIT(0); > > static bool hw_memory_failure __read_mostly = false; > > -static bool __page_handle_poison(struct page *page) > +/* > + * Return values: > + * 1: the page is dissolved (if needed) and taken off from buddy, > + * 0: the page is dissolved (if needed) and not taken off from buddy, > + * < 0: failed to dissolve. > + */ > +static int __page_handle_poison(struct page *page) > { > int ret; > > @@ -81,7 +87,7 @@ static bool __page_handle_poison(struct page *page) > ret = take_page_off_buddy(page); > zone_pcp_enable(page_zone(page)); > > - return ret > 0; > + return ret; > } > > static bool page_handle_poison(struct page *page, bool hugepage_or_freepage, bool release) > @@ -91,7 +97,7 @@ static bool page_handle_poison(struct page *page, bool hugepage_or_freepage, boo > * Doing this check for free pages is also fine since dissolve_free_huge_page > * returns 0 for non-hugetlb pages as well. > */ > - if (!__page_handle_poison(page)) > + if (__page_handle_poison(page) <= 0) > /* > * We could fail to take off the target page from buddy > * for example due to racy page allocation, but that's > @@ -1048,7 +1054,7 @@ static int me_huge_page(struct page_state *ps, struct page *p) > * subpages. > */ > put_page(hpage); > - if (__page_handle_poison(p)) { > + if (__page_handle_poison(p) > 0) { > page_ref_inc(p); > res = MF_RECOVERED; > } > @@ -1698,8 +1704,7 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb > */ > if (res == 0) { > unlock_page(head); > - res = MF_FAILED; It seems the previous discussion in [1] is missed. But that doesn't matter as pointed out by [1]. :) Reviewed-by: Miaohe Lin Thanks. [1]: https://lkml.org/lkml/2022/6/8/10 > - if (__page_handle_poison(p)) { > + if (__page_handle_poison(p) > 0) { > page_ref_inc(p); > res = MF_RECOVERED; > } >