From patchwork Sat Jan 29 21:41:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12729645 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E553C433EF for ; Sat, 29 Jan 2022 21:41:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F39F86B007B; Sat, 29 Jan 2022 16:41:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EEA926B007D; Sat, 29 Jan 2022 16:41:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD8426B007E; Sat, 29 Jan 2022 16:41:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay036.a.hostedemail.com [64.99.140.36]) by kanga.kvack.org (Postfix) with ESMTP id D113E6B007B for ; Sat, 29 Jan 2022 16:41:05 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 9856B1205CF for ; Sat, 29 Jan 2022 21:41:05 +0000 (UTC) X-FDA: 79084645290.01.D7176AE Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf22.hostedemail.com (Postfix) with ESMTP id EB315C0003 for ; Sat, 29 Jan 2022 21:41:04 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C6A41B82812; Sat, 29 Jan 2022 21:41:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32A77C340EF; Sat, 29 Jan 2022 21:41:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1643492462; bh=zSDHBCH3P+O3RfADVkHf3HrCwZThcIKMpyMGSUaHFTE=; h=Date:From:To:Subject:In-Reply-To:From; b=ajVnHrAzTfRGvISu0hsTXjwtD20AhQKhFtw3ozkj2Fj7RZwLUUkg9Z8WR185+tsXk 5xMEstpmxslkuudso4Om7RkMkIT+hRDjmlYD55UxCGXEXZS0KijV4vWFoNrpN5wsxr NEpY6bt29GYQQFsZRgZtKDjkPLAHXCusfGBhAs0I= Date: Sat, 29 Jan 2022 13:41:01 -0800 From: Andrew Morton To: akpm@linux-foundation.org, dan.j.williams@intel.com, jane.chu@oracle.com, joao.m.martins@oracle.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, naoya.horiguchi@nec.com, songmuchun@bytedance.com, torvalds@linux-foundation.org Subject: [patch 04/12] memory-failure: fetch compound_head after pgmap_pfn_valid() Message-ID: <20220129214101.N9rZeRVSg%akpm@linux-foundation.org> In-Reply-To: <20220129134026.8ccf701012f26eb2c2c269c9@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Stat-Signature: 43w8ncu9w4c6w4qg6z649i41ykqdgkxm X-Rspam-User: nil Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=ajVnHrAz; spf=pass (imf22.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: EB315C0003 X-HE-Tag: 1643492464-421278 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: Joao Martins Subject: memory-failure: fetch compound_head after pgmap_pfn_valid() memory_failure_dev_pagemap() at the moment assumes base pages (e.g. dax_lock_page()). For devmap with compound pages fetch the compound_head in case a tail page memory failure is being handled. Currently this is a nop, but in the advent of compound pages in dev_pagemap it allows memory_failure_dev_pagemap() to keep working. Without this fix memory-failure handling (i.e. MCEs on pmem) with device-dax configured namespaces will regress (and crash). Link: https://lkml.kernel.org/r/20211202204422.26777-2-joao.m.martins@oracle.com Reported-by: Jane Chu Signed-off-by: Joao Martins Reviewed-by: Naoya Horiguchi Reviewed-by: Dan Williams Reviewed-by: Muchun Song Signed-off-by: Andrew Morton --- mm/memory-failure.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/mm/memory-failure.c~memory-failure-fetch-compound_head-after-pgmap_pfn_valid +++ a/mm/memory-failure.c @@ -1596,6 +1596,12 @@ static int memory_failure_dev_pagemap(un } /* + * Pages instantiated by device-dax (not filesystem-dax) + * may be compound pages. + */ + page = compound_head(page); + + /* * Prevent the inode from being freed while we are interrogating * the address_space, typically this would be handled by * lock_page(), but dax pages do not use the page lock. This