From patchwork Thu Jul 15 15:08:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Wang X-Patchwork-Id: 12380275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D227C07E96 for ; Thu, 15 Jul 2021 15:09:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7AD0760200 for ; Thu, 15 Jul 2021 15:09:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7AD0760200 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A60148D00D8; Thu, 15 Jul 2021 11:09:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A104B8D00CD; Thu, 15 Jul 2021 11:09:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D7E58D00D8; Thu, 15 Jul 2021 11:09:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id 6BCFD8D00CD for ; Thu, 15 Jul 2021 11:09:33 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 3DFF98248047 for ; Thu, 15 Jul 2021 15:09:32 +0000 (UTC) X-FDA: 78365156184.36.59A50C3 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf21.hostedemail.com (Postfix) with ESMTP id 33272D0074A2 for ; Thu, 15 Jul 2021 15:09:31 +0000 (UTC) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4GQd226hnvz7tgb; Thu, 15 Jul 2021 23:04:26 +0800 (CST) Received: from dggema753-chm.china.huawei.com (10.1.198.195) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Thu, 15 Jul 2021 23:08:56 +0800 Received: from huawei.com (10.174.179.206) by dggema753-chm.china.huawei.com (10.1.198.195) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 15 Jul 2021 23:08:56 +0800 From: Bin Wang To: CC: , , , Subject: [PATCH] mm/hwpoison: dissolve error hugepages of file mapping Date: Thu, 15 Jul 2021 23:08:52 +0800 Message-ID: <20210715150852.1655-1-wangbin224@huawei.com> X-Mailer: git-send-email 2.29.2.windows.3 MIME-Version: 1.0 X-Originating-IP: [10.174.179.206] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggema753-chm.china.huawei.com (10.1.198.195) X-CFilter-Loop: Reflected Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of wangbin224@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangbin224@huawei.com; dmarc=pass (policy=none) header.from=huawei.com X-Rspamd-Server: rspam05 X-Stat-Signature: zj8ztesawwsfscfosbjz4e7qhz1o98ap X-Rspamd-Queue-Id: 33272D0074A2 X-HE-Tag: 1626361771-521407 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: We handle error on hugetlb file with hugetlbfs_error_remove_page(), which removes the error hugepages from page cache. And with the HWPoison flag in head page, it is safe to free the error hugepages and dissolve it. Fixes: 78bb920344b8a ("mm: hwpoison: dissolve in-use hugepage in unrecoverable memory error") Signed-off-by: Bin Wang --- mm/memory-failure.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index eefd823deb67..6a3c46b601ef 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -988,6 +988,13 @@ static int me_huge_page(struct page *p, unsigned long pfn) if (mapping) { res = truncate_error_page(hpage, pfn, mapping); unlock_page(hpage); + if (ret == MF_RECOVERED) { + put_page(hpage); + if (__page_handle_poison(p)) + page_ref_inc(p); + else + ret = MF_FAILED; + } } else { res = MF_FAILED; unlock_page(hpage);