Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2310828imn; Mon, 1 Aug 2022 20:20:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR4xLzU25rb2Af/mIQhGsCbDLlDWJGQD+wv8dyDAOinGzV9Y2H9/XLh9lEwixXrqnf7tVDqN X-Received: by 2002:a17:90b:1b08:b0:1f5:b65:9654 with SMTP id nu8-20020a17090b1b0800b001f50b659654mr6393010pjb.77.1659410447629; Mon, 01 Aug 2022 20:20:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659410447; cv=none; d=google.com; s=arc-20160816; b=SxnOFGwZhruspCQsy90C+ep8CG9Kv9ZCt/hVUjHOzDY+SoOYj+jxMAS7Vty5fjnlAl ycAkopvkVvMLRXumAKBLYUptFaduonb1J5H6a1Jh2wl1i4S405Gh8TTUHEkwh0W7YtXM WN155e/fpRCA4G04A4WAQ7wLJ/5WOtiwOoccJgtKuNmLbjQRXYxsrvb4hgC1h2jwfK3t 1l+8B1CKW5m88j1YKaKvADRp/JtvsaHRnRVNKttPWdfWWSp0YlvPhRm+0G3eXLDox7LL a9nIKyha12deT8v51odfIP/ng2SZH/Ae9/BywgsA/nviTkz/OIOi0s5iJ9N6OhtXgUEk H1sA== 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; bh=oKaFgTWMnv2nqP7QeF9oob59hrO7YoKulpo4lIUQVyA=; b=NcFNpCAsYq1ew8wUVF/JZzGN4UBXOpjYcJCZqb064xhtw43luazgSBk4jPBDhsALEh HOGYoAH+KfwiVNBCYDuphN3IxXYl48Eiw+PxpzKc4snyPKH1ByM8/WHOhzuhnwevorrr 4C7ThKF3Cw1eH82MEyjzc4O39Y6thP9Sf5tAbyJPWYMVEGFF0m4pKPEjr7zczxNPYaN3 rL29tDw5lu9cLkaAhRFLiDNjzDLiimYcOTXbS1pU2jIH07rGLa5CZZg4JNJpJa3a0OyL 17+6oBgYbCIpdGXRjCjVvBqVk7bAvqPjBKjdbm1DC2IcJEfxPHMSLW0TLr3cH+T5zkyS rBhg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 83-20020a630256000000b0041c506dde92si2330150pgc.636.2022.08.01.20.20.33; Mon, 01 Aug 2022 20:20:47 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235450AbiHBCIG (ORCPT + 99 others); Mon, 1 Aug 2022 22:08:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232390AbiHBCIE (ORCPT ); Mon, 1 Aug 2022 22:08:04 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF0B341D10 for ; Mon, 1 Aug 2022 19:08:02 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Lxdd93KQqzmVnK; Tue, 2 Aug 2022 10:06:05 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 2 Aug 2022 10:08:00 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 2 Aug 2022 10:08:00 +0800 From: Kefeng Wang To: Naoya Horiguchi , Miaohe Lin , Andrew Morton , CC: , Kefeng Wang Subject: [PATCH] mm: memory-failure: cleanup try_to_split_thp_page() Date: Tue, 2 Aug 2022 10:12:56 +0800 Message-ID: <20220802021256.162269-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 Since commit 5d1fd5dc877b ("mm,hwpoison: introduce MF_MSG_UNSPLIT_THP"), the action_result() called to show memory error event in memory_failure(), so the pr_info() in try_to_split_thp_page() is only needed in soft_offline_in_use_page(). Signed-off-by: Kefeng Wang --- mm/memory-failure.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index f0e1961d4482..59633a617a0a 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1524,20 +1524,18 @@ static int identify_page_state(unsigned long pfn, struct page *p, return page_action(ps, p, pfn); } -static int try_to_split_thp_page(struct page *page, const char *msg) +static int try_to_split_thp_page(struct page *page) { + int ret; + lock_page(page); - if (unlikely(split_huge_page(page))) { - unsigned long pfn = page_to_pfn(page); + ret = split_huge_page(page); + unlock_page(page); - unlock_page(page); - pr_info("%s: %#lx: thp split failed\n", msg, pfn); + if (unlikely(ret)) put_page(page); - return -EBUSY; - } - unlock_page(page); - return 0; + return ret; } static void unmap_and_kill(struct list_head *to_kill, unsigned long pfn, @@ -2079,7 +2077,7 @@ int memory_failure(unsigned long pfn, int flags) * page is a valid handlable page. */ SetPageHasHWPoisoned(hpage); - if (try_to_split_thp_page(p, "Memory Failure") < 0) { + if (try_to_split_thp_page(p) < 0) { action_result(pfn, MF_MSG_UNSPLIT_THP, MF_IGNORED); res = -EBUSY; goto unlock_mutex; @@ -2503,8 +2501,11 @@ static int soft_offline_in_use_page(struct page *page) struct page *hpage = compound_head(page); if (!PageHuge(page) && PageTransHuge(hpage)) - if (try_to_split_thp_page(page, "soft offline") < 0) + if (try_to_split_thp_page(page) < 0) { + pr_info("soft offline: %#lx: thp split failed\n", + page_to_pfn(page)); return -EBUSY; + } return __soft_offline_page(page); } -- 2.35.3