From patchwork Thu Sep 30 21:53:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12529369 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 53221C43217 for ; Thu, 30 Sep 2021 21:53:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EC930619F8 for ; Thu, 30 Sep 2021 21:53:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EC930619F8 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 8C3CC9400D5; Thu, 30 Sep 2021 17:53:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84E2294003A; Thu, 30 Sep 2021 17:53:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C5D89400D5; Thu, 30 Sep 2021 17:53:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 5B81C94003A for ; Thu, 30 Sep 2021 17:53:20 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 126A3180AC498 for ; Thu, 30 Sep 2021 21:53:20 +0000 (UTC) X-FDA: 78645591360.36.F2A499D Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf25.hostedemail.com (Postfix) with ESMTP id B385BB0001B2 for ; Thu, 30 Sep 2021 21:53:19 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id me5-20020a17090b17c500b0019af76b7bb4so7779349pjb.2 for ; Thu, 30 Sep 2021 14:53:19 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=WNfb7Z+wUBDNis53ymmcIpFweUVDBAEhTaRnY1TJVBw=; b=G9QLs9Qn5P/4JdctPSPNBA4PEalzsnjwlft8+Q81RMPBqVZGcv4i6y+gomgUSyMnnu JeeIOYnbJx+m/3ntVOiNWPjEYmAkksmDmqA1FY+ajgKAa65tACZNQ+nLrnNM+hQbqn5f i1gh5mbRKXaZ7whEDz6y/7MpP0yLPbCh3102O3B8espKozZHWjNnca6PsoYGxqIf695c GZoGLL5rsokg0Wfx2aKGLXt4NPJQar03Z9FbvCVBDdUTpyKZPkxIdBMR/oNMyTmkUd7+ //TSqaH+4hZ92j0LPWS92+2MSaz5DD2X/F2mCLTFimOQtmvQ7Q5WAd78xxZ0j/NygBB+ T8Ig== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=WNfb7Z+wUBDNis53ymmcIpFweUVDBAEhTaRnY1TJVBw=; b=AVbOby54CTwLREDmsJqM6pMsqXxfZ1Wp6tGCsbVHFa0kRxUwU+Pgu19HS4URI6iGnl AG5iZV1sGsc1GpY3fPVr0rMUnClI2rJzOAGP4xYey3qln0ce4DdMh0WxVh+L9X0m8bHX x0tHh1QZDYQEL1e1lxXoO8WeGTdSB7BEAbculvp2nwh0/ccFBKJqsNzhP1HceYy58IN5 WbV0hvKWE2ZeltzydwxtBlyglUBx33cu++K/U5AIKq/4nPQQx2TLugOsAfD0Yqzpfn6x KHUiTEgkRn9QgJaOULdoxumXXv44aeuJCSUFZIpjBQzihprB1vZHYnNd2IMJubvF37cf BgBg== X-Gm-Message-State: AOAM532o/tMcGYTUpxEAhK6Xo0SOlZgN8hDTNWqqqBPsOdSHk/Ad8cvj Xanh9BpmUy036ns9pPJt7Qk= X-Google-Smtp-Source: ABdhPJw1QT6Dh2Fy4U+xoL6nuH+kzP+CzA+JWdXmqXlj3S5NHYicwmkhVpyivlcJIlmw3AhsXXFidw== X-Received: by 2002:a17:90a:6649:: with SMTP id f9mr8798856pjm.15.1633038798483; Thu, 30 Sep 2021 14:53:18 -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 p17sm5647535pjg.54.2021.09.30.14.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 14:53:17 -0700 (PDT) From: Yang Shi To: naoya.horiguchi@nec.com, hughd@google.com, kirill.shutemov@linux.intel.com, willy@infradead.org, peterx@redhat.com, osalvador@suse.de, akpm@linux-foundation.org Cc: shy828301@gmail.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [v3 PATCH 1/5] mm: hwpoison: remove the unnecessary THP check Date: Thu, 30 Sep 2021 14:53:07 -0700 Message-Id: <20210930215311.240774-2-shy828301@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210930215311.240774-1-shy828301@gmail.com> References: <20210930215311.240774-1-shy828301@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B385BB0001B2 X-Stat-Signature: 5nf58sgf9fabag8fyj5yfryz5dai7k5s Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=G9QLs9Qn; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of shy828301@gmail.com designates 209.85.216.50 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-HE-Tag: 1633038799-824130 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: 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 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. Cc: Suggested-by: Naoya Horiguchi Signed-off-by: Yang Shi Acked-by: Naoya Horiguchi --- mm/memory-failure.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 54879c339024..ed28eba50f98 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1147,20 +1147,6 @@ static int __get_hwpoison_page(struct page *page) 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;