From patchwork Mon Nov 1 19:48:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12597145 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50424C433F5 for ; Mon, 1 Nov 2021 19:49:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F2146610F7 for ; Mon, 1 Nov 2021 19:49:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F2146610F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 85BDD940027; Mon, 1 Nov 2021 15:49:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 80AD394000F; Mon, 1 Nov 2021 15:49:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6FAA3940027; Mon, 1 Nov 2021 15:49:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0077.hostedemail.com [216.40.44.77]) by kanga.kvack.org (Postfix) with ESMTP id 6004294000F for ; Mon, 1 Nov 2021 15:49:01 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1D34D1803E8FB for ; Mon, 1 Nov 2021 19:49:01 +0000 (UTC) X-FDA: 78761399640.29.CD93561 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf14.hostedemail.com (Postfix) with ESMTP id 77A8D600199C for ; Mon, 1 Nov 2021 19:49:01 +0000 (UTC) Received: by mail-pl1-f180.google.com with SMTP id r5so12370407pls.1 for ; Mon, 01 Nov 2021 12:49:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PKFRq9HbcghGVdCADEk0F25dG6nzRjSV9nvm54bAxok=; b=GF5pX1FCoKVkDqtx4hZJbmPDkjQY3uA4vRV4wZhR4A6cU0yXIg1odvM7maJzRpKrv2 TrNV860oSWX0FeUk1CovvzLwfQmdlGwxFWQCjfV7ybHg++6QwLOL2AKPqEMVVvg7qeP3 XAPIhvNtu8P2vTRcLiE4g1atGyh8+PPJZJFnk1scAkTpzRCe3yO0xWOZjN1U6oX1dvVu AlSwJFYmTzYge+/O/iea6ovFR37dpDoVbsb1s7MtFrze9iWvBQ9EyMO7wpWt0Grm6vjx Wv5vMpsIMZU3/qFsWLvNHBlCzO6AmW4OyJ9+ESjAMftwlMMqH1JpQqXTf/+G/eIuMbYv VmiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PKFRq9HbcghGVdCADEk0F25dG6nzRjSV9nvm54bAxok=; b=SFBVRXbd7uQDtVfhQz9wSbM6JDTEFjRheSOJQ5uPYHKXlGfIwRj+TXVXADopJbhdmL fKCE0CB4AbljJSSMFBycSYeuK+vT7VqHWJwgfhkeuiYiFRjPiq6BYuYMAQL3zwPH+omB b1Zv/SV7OK5fyuqbQUpv1CMhw5D8LBgQ0wEf0gKysFdc5PMgCCKyGMT2Id3dA9lOWJJS tNd8pImXCq0sBTpRpIJuUNysCrR1ATQm3MnaGgMBlb8HBBWLo191MGmxGhyK4L6pDRe+ ptMmAb+nkzTKv6wHyk+K0SRytRlczwyweBuFA9V5ckgDyh0dERGh5k79SHjLRtv6g5a0 N1KA== X-Gm-Message-State: AOAM532hCoimMfOkBdm9VKoFzOAJiYgiqz+N61sqGnyuYtig4WFPVKfz HIYF4LPlx9nKoyN7DmYbTG4= X-Google-Smtp-Source: ABdhPJw8SGBgSebBiMYcJiqbo8z+BLaUb9mWPrtdsu+eRZvzQE3oxzKuH7Z2VrtVHfW8pdNma16kLA== X-Received: by 2002:a17:902:aa03:b0:13f:a07e:da04 with SMTP id be3-20020a170902aa0300b0013fa07eda04mr26731470plb.80.1635796139672; Mon, 01 Nov 2021 12:48:59 -0700 (PDT) Received: from localhost.localdomain (c-73-93-239-127.hsd1.ca.comcast.net. [73.93.239.127]) by smtp.gmail.com with ESMTPSA id j6sm13496754pgq.0.2021.11.01.12.48.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 12:48:58 -0700 (PDT) From: Yang Shi To: gregkh@linuxfoundation.org, naoya.horiguchi@nec.com, hughd@google.com, kirill.shutemov@linux.intel.com, willy@infradead.org, osalvador@suse.de, peterx@redhat.com, akpm@linux-foundation.org Cc: shy828301@gmail.com, stable@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [stable 5.10 PATCH] mm: hwpoison: remove the unnecessary THP check Date: Mon, 1 Nov 2021 12:48:56 -0700 Message-Id: <20211101194856.305642-1-shy828301@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 77A8D600199C X-Stat-Signature: 8kmgonjij31kcnxq7fyrp93g7goxrrfz Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=GF5pX1FC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of shy828301@gmail.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-HE-Tag: 1635796141-150672 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: commit c7cb42e94473aafe553c0f2a3d8ca904599399ed upstream. When handling THP hwpoison checked if the THP is in allocation or free stage since hwpoison may mistreat it as hugetlb page. After commit 415c64c1453a ("mm/memory-failure: split thp earlier in memory error handling") the problem has been fixed, so this check is no longer needed. Remove it. The side effect of the removal is hwpoison may report unsplit THP instead of unknown error for shmem THP. It seems not like a big deal. The following patch "mm: filemap: check if THP has hwpoisoned subpage for PMD page fault" depends on this, which fixes shmem THP with hwpoisoned subpage(s) are mapped PMD wrongly. So this patch needs to be backported to -stable as well. Link: https://lkml.kernel.org/r/20211020210755.23964-2-shy828301@gmail.com Signed-off-by: Yang Shi Suggested-by: Naoya Horiguchi Acked-by: Naoya Horiguchi Cc: Hugh Dickins Cc: Kirill A. Shutemov Cc: Matthew Wilcox Cc: Oscar Salvador Cc: Peter Xu Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm-filemap-check-if-thp-has-hwpoisoned-subpage-for-pmd-page-fault.patch depends on this one. mm/memory-failure.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 5d880d4eb9a2..bf601283fcf3 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -956,20 +956,6 @@ static int get_hwpoison_page(struct page *page) { struct page *head = compound_head(page); - if (!PageHuge(head) && PageTransHuge(head)) { - /* - * Non anonymous thp exists only in allocation/free time. We - * can't handle such a case correctly, so let's give it up. - * This should be better than triggering BUG_ON when kernel - * tries to touch the "partially handled" page. - */ - if (!PageAnon(head)) { - pr_err("Memory failure: %#lx: non anonymous thp\n", - page_to_pfn(page)); - return 0; - } - } - if (get_page_unless_zero(head)) { if (head == compound_head(page)) return 1;