Message ID | 20230711055016.2286677-3-linmiaohe@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp269942vqm; Mon, 10 Jul 2023 23:06:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlGFh8Zo+B/bvlDYMQJWQu+A/fSaZbfN0STmdyAeue+Ia/TiuTt+b3+xpbOqiEkA26IVT0NY X-Received: by 2002:a17:906:cf83:b0:992:bc8:58d9 with SMTP id um3-20020a170906cf8300b009920bc858d9mr13502627ejb.70.1689055587079; Mon, 10 Jul 2023 23:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689055587; cv=none; d=google.com; s=arc-20160816; b=mErlP6bAicXhOzPDSHhEZ2RGDqjxTqkPwipqT9T8ozkoRYMA0dtFRZTUEUlT9WHrE2 8OTwZEfE5sfGs2tmFVh/4PEmE4nD4LsvB52FUfWQ2YWlJG4uBxx6csm9iI3V6nNHKNjE 7bHhepgmgdcg7Kp0qgyQIlqiWNB+8398Q1PYCKjr/Vu4MhPiF2YPWWnKoc1AsCAM+jti yBMkoUtptmnOg3Pej52o9frhB2vF7rnnp6tUZffnHwr838Y/uNktkgDroHeWXZV8ebun 9wELxX9aazy65HwIA/yRzXlO5xrV+UaHZ/DmEamqMr/jPM12HpQjVWGQQCY0OaTblgV8 wtQg== 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=c3+4PRVCOc8lFGp+68fWiH4guLJbERi3j/h49cE9di0=; fh=4o7DIXI/66oHEW09L3854GeQKXh9nrvBy5ZxENMFBvA=; b=xX7KzsEdlc/lI2BLCJLgXgtTbes0zKX/QSkWqJ4CsK/D9pMzk2oA6+Ag5FvIOHdhsw DOysnOMHftGHh/6yJLdlJHD7dBT5PmLk2JpSSMZxBjVD9e0VeJoowJBHPKK7azKiUh+e uFWYgZS3SSVObieivydxKf0Ln6GYNZ5KZGmNjdjQ8HQtzq6O10O+0uHKYJyjXtU354cs 9tP27Tfx9oEHBmU38U9b0tvBftYQ1ILlc0oOrhwv1pAlqWrH20yuxOLEd5CTHKLr5/MJ fJBvQeoF1xVKVBvwDLnYuNWV9YHNcc0UQlVtH96qwbEpH8mo2PsEuXvP22fgaSiQT9sC Rf3g== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lc10-20020a170906f90a00b0094f34ed62d2si1233300ejb.366.2023.07.10.23.06.02; Mon, 10 Jul 2023 23:06:27 -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 S231195AbjGKFuf (ORCPT <rfc822;gnulinuxfreebsd@gmail.com> + 99 others); Tue, 11 Jul 2023 01:50:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230063AbjGKFuJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 11 Jul 2023 01:50:09 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D0A9E49 for <linux-kernel@vger.kernel.org>; Mon, 10 Jul 2023 22:50:07 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R0VJb4QvVzPk2m; Tue, 11 Jul 2023 13:47:43 +0800 (CST) Received: from huawei.com (10.174.151.185) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 11 Jul 2023 13:50:02 +0800 From: Miaohe Lin <linmiaohe@huawei.com> To: <akpm@linux-foundation.org>, <naoya.horiguchi@nec.com> CC: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>, <linmiaohe@huawei.com> Subject: [PATCH v2 2/8] mm: memory-failure: ensure moving HWPoison flag to the raw error pages Date: Tue, 11 Jul 2023 13:50:10 +0800 Message-ID: <20230711055016.2286677-3-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230711055016.2286677-1-linmiaohe@huawei.com> References: <20230711055016.2286677-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) 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,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771103151060676642 X-GMAIL-MSGID: 1771103151060676642 |
Series |
A few fixup and cleanup patches for memory-failure
|
|
Commit Message
Miaohe Lin
July 11, 2023, 5:50 a.m. UTC
If hugetlb_vmemmap_optimized is enabled, folio_clear_hugetlb_hwpoison() called from try_memory_failure_hugetlb() won't transfer HWPoison flag to subpages while folio's HWPoison flag is cleared. So when trying to free this hugetlb page into buddy, folio_clear_hugetlb_hwpoison() is not called to move HWPoison flag from head page to the raw error pages even if now hugetlb_vmemmap_optimized is cleared. This will results in HWPoisoned page being used again and raw_hwp_page leak. Fixes: ac5fcde0a96a ("mm, hwpoison: make unpoison aware of raw error info in hwpoisoned hugepage") Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com> --- mm/memory-failure.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 913fcf02ad38..feca3c4068a5 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1920,6 +1920,8 @@ void folio_clear_hugetlb_hwpoison(struct folio *folio) { if (folio_test_hugetlb_raw_hwp_unreliable(folio)) return; + if (folio_test_hugetlb_vmemmap_optimized(folio)) + return; folio_clear_hwpoison(folio); folio_free_raw_hwp(folio, true); }