Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp151406imw; Wed, 13 Jul 2022 21:37:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tGBJJOLRQXfqmpER7okbLRlE+hZuWM5mYuHqi5gVeJJujIjKg3Oh0//w4jUX/H8nUhrmwx X-Received: by 2002:a17:907:2888:b0:72b:4a91:b21a with SMTP id em8-20020a170907288800b0072b4a91b21amr6939599ejc.35.1657773464319; Wed, 13 Jul 2022 21:37:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657773464; cv=none; d=google.com; s=arc-20160816; b=SooJ6jdlAlSyJjq68HJsgxvImpYXMy2vxa3hoAJ9bEWXc6zKz3x5agL3PgkazPBoPd gPvosfmU9qtybDN1xTBKdgIYINRaeW/87OZ1C6Rwm+EzHCVvQ53VzoV/cA2S26hhvW50 Po7Kts/sfbKyMQGJ5pkf4+ATEtMhrt3ppMKQzBZLqCRjoqoexvCn7oLAGbBMQ7rWtivE M6cqJm+QcEB5Ss3YpLbQnGymobzoXKLBkV1f/S1EUMOzrnO65dfvCthAvdX9BdR7WEKb bOcmr/EuEIaCYLIpTRB4J/jZ9keSUq76EAPDGIua95xX4o1HMXfTtWx5E+FIFyWqVq3I iTWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=t1cH48TsYgnMbCs85Xjd/gEDfmg15eYdysyMKeEyQaw=; b=iHB1FALBC/AG48XUPoTLVVCJc77tftiBOZYvA81lH7rhY5jwv8xf5W+dWTllgXmtPd TBNlMzaKrf6k4tv0D6Ml2CY/MTNPfOxsPwlw666Zw23Fmvx925UfLqaNOTnd2eaHTfut ZWm7pnixyfyifzo6LoyZFdmlB8Vj4aFuNci+kUyx0cCCtmPT3+1KHewt+wdKpg5xsxjs sQ37fKiNRsDJl+7qZ94wtlPGgUcGaqzNbRdv+No9zBBm6pRwNosT2i7km2Hwux26DP5S tJzfTqHuJiWavIyZ6sbPrl0n9mggL+BNKbRCyU9VL9AOu4qx/Hn/G8TPaE6Vq8M8bKji /smQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=MK+VYGzF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a170906248500b00720fab07981si643011ejb.336.2022.07.13.21.37.17; Wed, 13 Jul 2022 21:37:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=MK+VYGzF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236997AbiGNEaj (ORCPT + 99 others); Thu, 14 Jul 2022 00:30:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237053AbiGNE3R (ORCPT ); Thu, 14 Jul 2022 00:29:17 -0400 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C737B3192C for ; Wed, 13 Jul 2022 21:24:59 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1657772697; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t1cH48TsYgnMbCs85Xjd/gEDfmg15eYdysyMKeEyQaw=; b=MK+VYGzFHPOhVzFkcB+WBdKd2SKCz3HDhj7lJOuCvwCqOvR1ka6CIA8COfVSSJa8TYsznd yld9V/YJipttANKJ/y1yiaPg2E3pEBrXWBBOMqaLi3iv5MxZJdR/ZtafuhZkOXk0frOxOY uhUGxs30vHI6QanO2s9rQUQ4wcPT2mc= From: Naoya Horiguchi To: linux-mm@kvack.org Cc: Andrew Morton , David Hildenbrand , Mike Kravetz , Miaohe Lin , Liu Shixin , Yang Shi , Oscar Salvador , Muchun Song , Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: [mm-unstable PATCH v7 6/8] mm, hwpoison: make __page_handle_poison returns int Date: Thu, 14 Jul 2022 13:24:18 +0900 Message-Id: <20220714042420.1847125-7-naoya.horiguchi@linux.dev> In-Reply-To: <20220714042420.1847125-1-naoya.horiguchi@linux.dev> References: <20220714042420.1847125-1-naoya.horiguchi@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Miaohe Lin --- v2 -> v3: - move deleting "res = MF_FAILED" to the later patch. (by Miaohe) --- mm/memory-failure.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index f15d521c3f1f..c8fa3643791c 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 @@ -1086,7 +1092,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; } @@ -1869,7 +1875,7 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb if (res == 0) { unlock_page(head); res = MF_FAILED; - if (__page_handle_poison(p)) { + if (__page_handle_poison(p) > 0) { page_ref_inc(p); res = MF_RECOVERED; } -- 2.25.1