From patchwork Mon Jan 10 17:31:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Mostafa X-Patchwork-Id: 1578037 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=nbNOhgdo; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JXgqf5zM4z9sSs for ; Tue, 11 Jan 2022 04:31:58 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1n6yWN-0004Ee-NA; Mon, 10 Jan 2022 17:31:51 +0000 Received: from smtp-relay-canonical-0.internal ([10.131.114.83] helo=smtp-relay-canonical-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1n6yWM-0004Dt-4I for kernel-team@lists.ubuntu.com; Mon, 10 Jan 2022 17:31:50 +0000 Received: from ascalon (unknown [192.188.8.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id DF0CE40004 for ; Mon, 10 Jan 2022 17:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1641835909; bh=QcLpTG5UAbiI921ykpER0OF0fp9tHwz7at2R47w356c=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References; b=nbNOhgdokMVbWffyLpRTBEuj9Pdu7WFizwqqlotnFAPAbyKWiDpRGAS1mxJLkRQed caRvYF6Ky32nNWUx9OrfbPrUolosBoR2922s+vz+aMcPTpkCpqsnlo/rEAYs4Y6wb8 bFSfdZgyEBOpMN33XQGOkqgbVkfrXpCMgMNZn4kfk0r3EXmeVgW1hIZ+NHYOufN8Hr tyKL+OwSta9yLB5PjbBgsK+YO3CBlnpSnYC7K9FqTcb5BM9uV38g2TNreXKTbg0jpP 04uMa+Ir4lJh9B2ab27nn9aSzEQ/5QZCcrngQ2MB+rwmgFxqqd3HU89CYivWV8I9Fh X9+h2sUIV710Q== Received: from kamal by ascalon with local (Exim 4.90_1) (envelope-from ) id 1n6yWJ-0003tN-Mg for kernel-team@lists.ubuntu.com; Mon, 10 Jan 2022 09:31:47 -0800 From: Kamal Mostafa To: kernel-team@lists.ubuntu.com Subject: [Hirsute][PATCH 1/2] Revert "mm: filemap: check if THP has hwpoisoned subpage for PMD page fault" Date: Mon, 10 Jan 2022 09:31:43 -0800 Message-Id: <20220110173144.14826-2-kamal@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220110173144.14826-1-kamal@canonical.com> References: <20220110173144.14826-1-kamal@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1956984 This reverts commit 327aa2137d989f278ece7e8e31c218dfb3416c35. This Ubuntu backport is bogus (hunk applied to routine finish_fault() should have been applied to do_set_pmd()). To be replaced by corrected backport. Signed-off-by: Kamal Mostafa --- include/linux/page-flags.h | 23 ----------------------- mm/huge_memory.c | 2 -- mm/memory-failure.c | 14 -------------- mm/memory.c | 9 --------- mm/page_alloc.c | 4 +--- 5 files changed, 1 insertion(+), 51 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 9b85f492bf56..ec5d0290e0ee 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -168,15 +168,6 @@ enum pageflags { /* Compound pages. Stored in first tail page's flags */ PG_double_map = PG_workingset, -#ifdef CONFIG_MEMORY_FAILURE - /* - * Compound pages. Stored in first tail page's flags. - * Indicates that at least one subpage is hwpoisoned in the - * THP. - */ - PG_has_hwpoisoned = PG_mappedtodisk, -#endif - /* non-lru isolated movable page */ PG_isolated = PG_reclaim, @@ -709,20 +700,6 @@ PAGEFLAG_FALSE(DoubleMap) TESTSCFLAG_FALSE(DoubleMap) #endif -#if defined(CONFIG_MEMORY_FAILURE) && defined(CONFIG_TRANSPARENT_HUGEPAGE) -/* - * PageHasHWPoisoned indicates that at least one subpage is hwpoisoned in the - * compound page. - * - * This flag is set by hwpoison handler. Cleared by THP split or free page. - */ -PAGEFLAG(HasHWPoisoned, has_hwpoisoned, PF_SECOND) - TESTSCFLAG(HasHWPoisoned, has_hwpoisoned, PF_SECOND) -#else -PAGEFLAG_FALSE(HasHWPoisoned) - TESTSCFLAG_FALSE(HasHWPoisoned) -#endif - /* * For pages that are never mapped to userspace (and aren't PageSlab), * page_type may be used. Because it is initialised to -1, we invert the diff --git a/mm/huge_memory.c b/mm/huge_memory.c index eab1ed3e9675..f735eb3755db 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2499,8 +2499,6 @@ static void __split_huge_page(struct page *page, struct list_head *list, /* lock lru list/PageCompound, ref freezed by page_ref_freeze */ lruvec = lock_page_lruvec(head); - ClearPageHasHWPoisoned(head); - for (i = nr - 1; i >= 1; i--) { __split_huge_page_tail(head, i, lruvec, list); /* Some pages can be beyond i_size: drop them from page cache */ diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 9890f822d692..5562b00db788 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1474,20 +1474,6 @@ int memory_failure(unsigned long pfn, int flags) } if (PageTransHuge(hpage)) { - /* - * The flag must be set after the refcount is bumped - * otherwise it may race with THP split. - * And the flag can't be set in get_hwpoison_page() since - * it is called by soft offline too and it is just called - * for !MF_COUNT_INCREASE. So here seems to be the best - * place. - * - * Don't need care about the above error handling paths for - * get_hwpoison_page() since they handle either free page - * or unhandlable page. The refcount is bumped iff the - * page is a valid handlable page. - */ - SetPageHasHWPoisoned(hpage); if (try_to_split_thp_page(p, "Memory Failure") < 0) { action_result(pfn, MF_MSG_UNSPLIT_THP, MF_IGNORED); res = -EBUSY; diff --git a/mm/memory.c b/mm/memory.c index c5c4edd74b5c..f7d2fc871423 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3923,15 +3923,6 @@ vm_fault_t finish_fault(struct vm_fault *vmf) else page = vmf->page; - /* - * Just backoff if any subpage of a THP is corrupted otherwise - * the corrupted page may mapped by PMD silently to escape the - * check. This kind of THP just can be PTE mapped. Access to - * the corrupted subpage should trigger SIGBUS as expected. - */ - if (unlikely(PageHasHWPoisoned(page))) - return ret; - /* * check even for read faults because we might have lost our CoWed * page diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a65a76a7fb5a..132c85fa0913 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1236,10 +1236,8 @@ static __always_inline bool free_pages_prepare(struct page *page, VM_BUG_ON_PAGE(compound && compound_order(page) != order, page); - if (compound) { + if (compound) ClearPageDoubleMap(page); - ClearPageHasHWPoisoned(page); - } for (i = 1; i < (1 << order); i++) { if (compound) bad += free_tail_pages_check(page, page + i);