From patchwork Thu Oct 28 21:36:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12591223 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 732DAC433F5 for ; Thu, 28 Oct 2021 21:36:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0B55E610CA for ; Thu, 28 Oct 2021 21:36:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0B55E610CA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id A7E966B0073; Thu, 28 Oct 2021 17:36:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A2DDA6B0074; Thu, 28 Oct 2021 17:36:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 91CC3940007; Thu, 28 Oct 2021 17:36:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id 6C5046B0073 for ; Thu, 28 Oct 2021 17:36:10 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DF8C61830451D for ; Thu, 28 Oct 2021 21:36:09 +0000 (UTC) X-FDA: 78747154458.25.502D3E1 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf10.hostedemail.com (Postfix) with ESMTP id AE4496001E54 for ; Thu, 28 Oct 2021 21:36:01 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 55BAF60FE3; Thu, 28 Oct 2021 21:36:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1635456968; bh=84gMrMkS11wA2Rk+CJ1QmnKRVd4oIENPgFHHYXhN+rA=; h=Date:From:To:Subject:In-Reply-To:From; b=VMN4m3C4Url1lvCikMOZE/mPmbO53vmzk4UoekmcnVF3/yqZhc+6BYjHKGMmQPykI TRcZJe9JtUhVIc1rxauLCDLa1XILkzXG4dYTMc9TDr/bPzIqiJD/Smfx6LASkgg1pq 8C2Yyu5Pxg9e3iiCpqoo7YwIL6J6tA9LGRxnw/X4= Date: Thu, 28 Oct 2021 14:36:07 -0700 From: Andrew Morton To: akpm@linux-foundation.org, hughd@google.com, kirill.shutemov@linux.intel.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, naoya.horiguchi@nec.com, osalvador@suse.de, peterx@redhat.com, shy828301@gmail.com, stable@vger.kernel.org, torvalds@linux-foundation.org, willy@infradead.org Subject: [patch 02/11] mm: hwpoison: remove the unnecessary THP check Message-ID: <20211028213607.dE5Qz5QgJ%akpm@linux-foundation.org> In-Reply-To: <20211028143506.5f5d5e2cd1f768a1da864844@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: AE4496001E54 X-Stat-Signature: 7asabg719s668q4znr43bik7xc6p3m87 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=VMN4m3C4; dmarc=none; spf=pass (imf10.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1635456961-553615 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: From: Yang Shi Subject: mm: hwpoison: remove the unnecessary THP check 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 --- mm/memory-failure.c | 14 -------------- 1 file changed, 14 deletions(-) --- a/mm/memory-failure.c~mm-hwpoison-remove-the-unnecessary-thp-check +++ a/mm/memory-failure.c @@ -1147,20 +1147,6 @@ static int __get_hwpoison_page(struct pa if (!HWPoisonHandlable(head)) return -EBUSY; - if (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;