From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4283FC47082 for ; Fri, 4 Jun 2021 01:20:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E3A4661168 for ; Fri, 4 Jun 2021 01:20:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E3A4661168 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fujitsu.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 866486B0071; Thu, 3 Jun 2021 21:20:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 816536B0072; Thu, 3 Jun 2021 21:20:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6DEAC6B0075; Thu, 3 Jun 2021 21:20:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0114.hostedemail.com [216.40.44.114]) by kanga.kvack.org (Postfix) with ESMTP id 3AF9D6B0071 for ; Thu, 3 Jun 2021 21:20:53 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D51F5DDF9 for ; Fri, 4 Jun 2021 01:20:52 +0000 (UTC) X-FDA: 78214287144.24.7E2F135 Received: from heian.cn.fujitsu.com (unknown [183.91.158.132]) by imf05.hostedemail.com (Postfix) with ESMTP id 987F6E0009A1 for ; Fri, 4 Jun 2021 01:20:26 +0000 (UTC) IronPort-HdrOrdr: =?us-ascii?q?A9a23=3AN4lpJ6sSDEGhtG3G4G6toNZs7skDktV00zEX?= =?us-ascii?q?/kB9WHVpmszxra6TdZMgpHnJYVcqKQgdcL+7WJVoLUmxyXcx2/h1AV7AZniAhI?= =?us-ascii?q?LLFvAA0WKK+VSJcEeSygce79YFT0EUMrzN5DZB4voSmDPIcerI3uP3jZyAtKPP?= =?us-ascii?q?yWt3VwF2Z+VF5wd9MAySFUp7X2B9dOEEPavZ9sxavCChZHhSSsy6A0MOV+/Fq8?= =?us-ascii?q?aOu4nhZXc9dmQawTjLnTW186T7DhTd+h8fVglEybAk/XOAsyGR3NTaj82G?= X-IronPort-AV: E=Sophos;i="5.83,246,1616428800"; d="scan'208";a="109209803" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 04 Jun 2021 09:19:06 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 4A1734C369E0; Fri, 4 Jun 2021 09:19:01 +0800 (CST) Received: from G08CNEXJMPEKD02.g08.fujitsu.local (10.167.33.202) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 4 Jun 2021 09:18:51 +0800 Received: from G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) by G08CNEXJMPEKD02.g08.fujitsu.local (10.167.33.202) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 4 Jun 2021 09:18:50 +0800 Received: from irides.mr.mr.mr (10.167.225.141) by G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 4 Jun 2021 09:18:50 +0800 From: Shiyang Ruan To: , , , , , CC: , , , , , , Subject: [PATCH v4 01/10] pagemap: Introduce ->memory_failure() Date: Fri, 4 Jun 2021 09:18:35 +0800 Message-ID: <20210604011844.1756145-2-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210604011844.1756145-1-ruansy.fnst@fujitsu.com> References: <20210604011844.1756145-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain X-yoursite-MailScanner-ID: 4A1734C369E0.AF67F X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: ruansy.fnst@fujitsu.com Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=none; spf=temperror (imf05.hostedemail.com: error in processing during lookup of ruansy.fnst@fujitsu.com: DNS error) smtp.mailfrom=ruansy.fnst@fujitsu.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 987F6E0009A1 X-Stat-Signature: 3smcamx66dicuj5k9ei3kqmf37uspqxs X-HE-Tag: 1622769626-459036 Content-Transfer-Encoding: quoted-printable 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 memory-failure occurs, we call this function which is implemented by each kind of devices. For the fsdax case, pmem device driver implements it. Pmem device driver will find out the filesystem in which the corrupted page located in. And finally call filesystem handler to deal with this error. The filesystem will try to recover the corrupted data if possiable. Signed-off-by: Shiyang Ruan --- include/linux/memremap.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/memremap.h b/include/linux/memremap.h index 45a79da89c5f..473fe18c516a 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -87,6 +87,14 @@ struct dev_pagemap_ops { * the page back to a CPU accessible page. */ vm_fault_t (*migrate_to_ram)(struct vm_fault *vmf); + + /* + * Handle the memory failure happens on one page. Notify the processes + * who are using this page, and try to recover the data on this page + * if necessary. + */ + int (*memory_failure)(struct dev_pagemap *pgmap, unsigned long pfn, + int flags); }; =20 #define PGMAP_ALTMAP_VALID (1 << 0) --=20 2.31.1