From patchwork Thu Nov 4 21:07:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12603801 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 683CAC4332F for ; Thu, 4 Nov 2021 21:07:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E28566124A for ; Thu, 4 Nov 2021 21:07:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E28566124A 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 18EBE6B0071; Thu, 4 Nov 2021 17:07:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 116F0940007; Thu, 4 Nov 2021 17:07:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F204E6B0073; Thu, 4 Nov 2021 17:07:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0234.hostedemail.com [216.40.44.234]) by kanga.kvack.org (Postfix) with ESMTP id E19596B0071 for ; Thu, 4 Nov 2021 17:07:56 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8EC51184EA70F for ; Thu, 4 Nov 2021 21:07:56 +0000 (UTC) X-FDA: 78772484952.04.F15710C Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by imf15.hostedemail.com (Postfix) with ESMTP id AE51BD0000A4 for ; Thu, 4 Nov 2021 21:07:45 +0000 (UTC) Received: by mail-pf1-f174.google.com with SMTP id g18so2238511pfk.5 for ; Thu, 04 Nov 2021 14:07:56 -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=9BiJt54qFZ/VuFOPoUw2HvY4OErYWaH/g0QELRHYaEM=; b=JR2B77A7w9AxNwZiwRneH3U+LDgO7FF6to59gQG7raqqjhoqQaITMu1qzPmDRxdQ1e HkM5PZsZZjGaSa5A4x03k5PzwVqNfTluN5kCPt/LHWA/+bnTDiLKzoutgfmfRiOO7OBi 3779F30Gzg9jNMvKNqo7IDTzrryKU/Wb4nxdSMkuW7Ga2wQAAMxb5mrowJtGyuEtiXqs 32kh0w+PYo/X9QHiehvQ5HNlxhCZWNo3HJntQsU+49r7PWh4LRpPFlMCKEsyR5cz4/v8 aLX5xkCun5dKl184rAsaLUawLTit6+7yG8rhTwRn26uqCAKeFkyMaPKad7jMSi4ntbw9 Ulng== 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=9BiJt54qFZ/VuFOPoUw2HvY4OErYWaH/g0QELRHYaEM=; b=akvIJQTqRs6DTpSvxS/F9haIklDdoCwy2PNGgVcLE9+fH8JQZArU1NAW7l7qZdExUH FlAL8QNISMF0x4rb9y4PvDrcLQVMsU97ExmbppcNFTX1uWHdc/X0W2Ab74Lb2q1N2G/I xKQZfsy5nX8ByrAPeZuDiA+yYS9+I11gnpuIEuG8XMhtqIw/+gZ8zYRDzelww0SOBPlI zKXINuPukYaxHLI6XxNnceXNi0HUYQlDEE6HGVQyn/jYLvOWfu7dSLnK21Iuzrfo6Mbg vMkzk0pO0/eK22iE3/pYA2noKGqlyOKdTzNliaWXWPy/5SPxgj3m1ZcWqP87TQQXqzbz r3jw== X-Gm-Message-State: AOAM5303s2ipdA+YJVR7g3B7kK4eqmYi75Jyj6KTHn6jMnsbclo+soMx uKY/vRTPQf7fMu5euMi1mnQ= X-Google-Smtp-Source: ABdhPJzL5YjCBbrnkOB2UCcpqKtJy28zI2Io3AbzarVO6TBw75pVAsBTv/HqC8QT0vlEL6Drk+j7sw== X-Received: by 2002:a65:4bca:: with SMTP id p10mr26097982pgr.391.1636060075178; Thu, 04 Nov 2021 14:07:55 -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 s69sm4523688pgc.43.2021.11.04.14.07.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Nov 2021 14:07:54 -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 v2 PATCH 1/2] mm: hwpoison: remove the unnecessary THP check Date: Thu, 4 Nov 2021 14:07:51 -0700 Message-Id: <20211104210752.390351-1-shy828301@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=JR2B77A7; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of shy828301@gmail.com designates 209.85.210.174 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: AE51BD0000A4 X-Stat-Signature: ypssozwsohgdwoa8m39krkik5nesau1i X-HE-Tag: 1636060065-442800 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/memory-failure.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 01445ddff58d..bd2cd4dd59b6 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;