Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp114092imw; Thu, 7 Jul 2022 22:42:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sLH7UXqWQrzX81u85aKGRvUrUdm4mRo+slUDiNoBahFhC3xtRtBMuomeYh22pVa8nlgkgT X-Received: by 2002:a17:90b:1d07:b0:1ef:afd1:9f1c with SMTP id on7-20020a17090b1d0700b001efafd19f1cmr9814401pjb.192.1657258976116; Thu, 07 Jul 2022 22:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657258976; cv=none; d=google.com; s=arc-20160816; b=wWK2avBYpIs8BLhD5zx11mAbMyPvydNvR9lWNU5NIR9V6NWlgE4x4MdAZfn8koAcBA Kz+ZINdqFYyf+03Vg5PT48hC5+z3pOw1XGarP6eEY9GIrBZziBlKQd2AygA8IOpqRqep +3Pt/t5uUbPlL1inbLDaavh2S7LuDkrhefDuccjqYFBe1/qWDD7emuHOO7hL4mrRHqu4 bDq6prkUppy1iZUd/hJ7rRcO8HtH3T4UXPKDSQrIfyZm80HuJxtx6K0zNr/yH69N8Z/G Gp9+5+aB23UDafvnvmHJ/S6iuxPOH5C76S5GG0oBdMlfsKaXPSjPAZj3nuykaPvK1+V3 XOHg== 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=a5cfdoF+Q3PicJ4hUmNvih68gRFF+QsIiLkN3fSd50o=; b=eTf4gOpDU2ERIr+69fiNrjonDDAulzlZu4X/Ykyz7qoUnCOOqmWceNXP3F+yrS8n3o nErOog1+Om/fyhHwRbj3F7cRtByArOMNWOdIBcdlqWfdjTb1dFaWVuKZlSFb/ZuRBrm9 STQXcqaCO4x2SICfhSW7XYG8x9x5ki8Eewzeb365L5t+hFbdeuMRs2IOK6YAG2rgw6vL EnZMXfuG22qVMby2Kf1L/y/T3JODDYitEBkfYC5AGtbLJUWkCQ1zc7bE7GUeFSTo4W55 RYmSS4twYB1pA254sAgkrmNlDVSxa5bqNTPQ15rytnLS47pGN1qqSdvJ5KjXi8mpErb/ GfKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=dGZnVxCk; 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 w5-20020a626205000000b0052847a685b8si24646282pfb.362.2022.07.07.22.42.43; Thu, 07 Jul 2022 22:42:56 -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=dGZnVxCk; 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 S237270AbiGHFiR (ORCPT + 99 others); Fri, 8 Jul 2022 01:38:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233524AbiGHFiE (ORCPT ); Fri, 8 Jul 2022 01:38:04 -0400 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3726F7B35C for ; Thu, 7 Jul 2022 22:38:00 -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=1657258678; 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=a5cfdoF+Q3PicJ4hUmNvih68gRFF+QsIiLkN3fSd50o=; b=dGZnVxCkoUtL6sNLsB3dTwycJsCSweuvR53NKdprQWpUOF7aAitjtx8LO8PaN2o98Fy0Iz U92RPkDv9w4zWN06Pq4UhoK1d12SJknNswFbK97MQc7h6K44GKn4u0LA6yzlKK1TQsa4Ym hSaN806fuk++YW//Bo8IG36oV2501gc= 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 v5 6/8] mm, hwpoison: make __page_handle_poison returns int Date: Fri, 8 Jul 2022 14:36:51 +0900 Message-Id: <20220708053653.964464-7-naoya.horiguchi@linux.dev> In-Reply-To: <20220708053653.964464-1-naoya.horiguchi@linux.dev> References: <20220708053653.964464-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 f17f0475db93..e38a94007ffe 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; } @@ -1855,7 +1861,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