Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1141924imk; Sun, 3 Jul 2022 18:36:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vzm5eADZJTWwDDj9WbGGNQd1qxXEwgJiwOfrDCXJSY8xXmqUx5IPtpbVIKINQZfH0UdKG1 X-Received: by 2002:a05:6402:360d:b0:435:710a:2531 with SMTP id el13-20020a056402360d00b00435710a2531mr34996713edb.377.1656898616934; Sun, 03 Jul 2022 18:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656898616; cv=none; d=google.com; s=arc-20160816; b=Yjv6Je+JLwV+RIoNTpqPOy0SsLGY7rxichkwsb2jtv+NOEjd8X2oT8ulxno1TsNG1i u66D+d6UBsTGwpk9MTLV0479Zl1ge4O8ZdAsBwFAvnfr0cJsnoM1snUXFYrmfxsKOZyL 4u3zlDoWZQPuXjaLORWuorsEEUTZGHolsQ/m70V/BuRWQpM11Va6Lw/8QqzZM4e8qbD3 gCh14SPtd7e8d0UtNTdQuMJeOlPWy2kaeVgYNaAoNuSDwEYMkl6W1Zb1bArNV1RmRfkb 2xO+CKCo5utGm8aW0DFp70D9tToKDjYVLNM0csSc4XXRjp0qshNgTC06NV91SewwSf2U 8jaA== 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=b93kxoYsvAwFUvAYzt37azWxoNvpZ6NPtNoPBk9U/1A=; b=mdutuQydlLwLR1Ue0nQhQQzMjqmxfhWNn+GbvCUDzedfE8pzB74B6Y3dWNmINhGLWk +L7Ivsf2WbXmfZ6uDhGOELuTbjkHQ5hjYqkVB2JPPJHhy22FR+VwGXH6MQT3Q5l7vNaM W49vINw+9gfKDvl89BZIbxG25kwjZ8BsiX78pWN6QCnY3sPZtE5iu/KmURMub4FODxLZ 4q4fUPIlzv7hr4MD0D7kOWbEh78ZZdDYWHvwnvLgLqwDc6YIawmC3zNlbJMv4UgZK5jB 9/VpzA21ycgtQHxir6PRFONxSlCDGR9vZViJM8DbG4ICgnstPDns0XMbMxC48IuoSn8J 3FvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=OubKvWLj; 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 qf22-20020a1709077f1600b00718ccb0a135si12414665ejc.507.2022.07.03.18.36.32; Sun, 03 Jul 2022 18:36: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=OubKvWLj; 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 S232824AbiGDBd6 (ORCPT + 99 others); Sun, 3 Jul 2022 21:33:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232803AbiGDBdz (ORCPT ); Sun, 3 Jul 2022 21:33:55 -0400 Received: from out0.migadu.com (out0.migadu.com [IPv6:2001:41d0:2:267::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 854F85FDA for ; Sun, 3 Jul 2022 18:33:54 -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=1656898433; 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=b93kxoYsvAwFUvAYzt37azWxoNvpZ6NPtNoPBk9U/1A=; b=OubKvWLjU/w0ll3ChvqkFJDpcLhk1I+t4VqgIrFtLZrJu1J1EFjoVOS3AXiN769tKKaDq0 Jdpo4ZprRxvNjyemXrCTE7S5GKSYnyHYmC63ULGsZi0W3maLEjSc7giWcPMKuvgPR+34mh WphfFVPBMIP8XphqZ4+Hz+bC0A1lE6U= 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 v4 7/9] mm, hwpoison: make __page_handle_poison returns int Date: Mon, 4 Jul 2022 10:33:10 +0900 Message-Id: <20220704013312.2415700-8-naoya.horiguchi@linux.dev> In-Reply-To: <20220704013312.2415700-1-naoya.horiguchi@linux.dev> References: <20220704013312.2415700-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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,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 4233b21328a5..c8939a39fbe6 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; } @@ -1850,7 +1856,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