From patchwork Fri Nov 5 20:41:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12605615 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 19998C43219 for ; Fri, 5 Nov 2021 20:41:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C851C61279 for ; Fri, 5 Nov 2021 20:41:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C851C61279 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 6A584940049; Fri, 5 Nov 2021 16:41:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 654C594007A; Fri, 5 Nov 2021 16:41:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 542E7940049; Fri, 5 Nov 2021 16:41:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0225.hostedemail.com [216.40.44.225]) by kanga.kvack.org (Postfix) with ESMTP id 43DCF94007A for ; Fri, 5 Nov 2021 16:41:16 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 0248E8249980 for ; Fri, 5 Nov 2021 20:41:16 +0000 (UTC) X-FDA: 78776046552.22.AC74E6F Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf01.hostedemail.com (Postfix) with ESMTP id D2020508FA48 for ; Fri, 5 Nov 2021 20:41:03 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 898FC611C0; Fri, 5 Nov 2021 20:41:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1636144874; bh=2sbxwZv0ZvcIIZZ5F7BXAbHE67nAS2XyR/CDD0yDCU8=; h=Date:From:To:Subject:In-Reply-To:From; b=YxVD7wu5cyEWNbVpoM05FULHPkuQ9l/RzGdzsj/MGjyf9LpGkIvhhyO7+BfvkQudS m2fzDKFxWifm6cdS+adZdL1GboPNQPtNZ1FmEeF9DZrciPw5sqLJCXifJK7kaD+yFW Tw+KbqbvLwx2xTQsEGkgPJCYsyAnKUjw+DdL5ggE= Date: Fri, 05 Nov 2021 13:41:14 -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, torvalds@linux-foundation.org, willy@infradead.org Subject: [patch 126/262] mm: hwpoison: handle non-anonymous THP correctly Message-ID: <20211105204114.oqF4Oa0js%akpm@linux-foundation.org> In-Reply-To: <20211105133408.cccbb98b71a77d5e8430aba1@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: D2020508FA48 X-Stat-Signature: j8p9gcoyrksn6majjic6mh7ykijjh1iy Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=YxVD7wu5; spf=pass (imf01.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-HE-Tag: 1636144863-261509 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: handle non-anonymous THP correctly Currently hwpoison doesn't handle non-anonymous THP, but since v4.8 THP support for tmpfs and read-only file cache has been added. They could be offlined by split THP, just like anonymous THP. Link: https://lkml.kernel.org/r/20211020210755.23964-7-shy828301@gmail.com Signed-off-by: Yang Shi Acked-by: Naoya Horiguchi Cc: Hugh Dickins Cc: Kirill A. Shutemov Cc: Matthew Wilcox Cc: Oscar Salvador Cc: Peter Xu Signed-off-by: Andrew Morton --- mm/memory-failure.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) --- a/mm/memory-failure.c~mm-hwpoison-handle-non-anonymous-thp-correctly +++ a/mm/memory-failure.c @@ -1444,14 +1444,11 @@ static int identify_page_state(unsigned static int try_to_split_thp_page(struct page *page, const char *msg) { lock_page(page); - if (!PageAnon(page) || unlikely(split_huge_page(page))) { + if (unlikely(split_huge_page(page))) { unsigned long pfn = page_to_pfn(page); unlock_page(page); - if (!PageAnon(page)) - pr_info("%s: %#lx: non anonymous thp\n", msg, pfn); - else - pr_info("%s: %#lx: thp split failed\n", msg, pfn); + pr_info("%s: %#lx: thp split failed\n", msg, pfn); put_page(page); return -EBUSY; }