Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3328555pxu; Tue, 15 Dec 2020 04:32:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXAvlI5lSykwQzgVIgPSWbi7/Cchd6ovgGni90Pcm4hScAJYDQLk4rQjMAtaeNdM/ibmvO X-Received: by 2002:a17:906:e8b:: with SMTP id p11mr16904881ejf.92.1608035568262; Tue, 15 Dec 2020 04:32:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608035568; cv=none; d=google.com; s=arc-20160816; b=ZeALKORLpm+nO1yjjBsqE1jpnAtzlNLlIm1PQDGdeNIOy4Q2ihNsQ0JOBJrIU7guuF NZYD+SRujFJ35O0f1GCjofQhnS+BmUNa6+UPOM012seXuQPr6rzSouD0UBuyPo86uZQo UO4pNnvz28skUA3pBE+2K5kVgKnd7i2/Ib9AcN52HCqICrfPezZsPMJ5riYNeyX+2vQw MG+Wdus7M9O+SYMKLpGJvDEuRUohbcqRZ9oJYOZIm82daeyJzb3qFcpqzsOCm4v9lxkC c99yoVNHOedxc+ArkMmuzzN9AIRqMUvhDNggz9PeOKM2cP6UTTBGK1VfYuur7h2YsSw2 dwTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=v0sU2PS65mj6SIrXlmE65a3nWxWuLWZagUw5I4XcO9E=; b=lBy41sbcF1ZpUw+QGloUhLfOHne/St3SBkPzylrnG3QKDJCv7nSBoO/s5iEid2aHyt Mt7jjrUyV2IbtJE6JLSCpQYZQbwttGshmLGAd0GsJu851qc5+5qp5vJ+VIZlKQ4tZFFg hziuqqivOn77VYicBNakJ2jqOgx4uDdoW3pX4Sj+zqCLSng6MBVlJkaHTPubuUsTuK1g 5Oav74U8NA4gtcu1bPk3VOomnnLZxb470SgRTpB3lD7Dx4kG1n1Fu3hQxhvicRziQLnl jke/QJjJ7duIiC1XaKkLf8lj5+mWXGqCmCKBqXIbI051JLN0W3ir+YztdjwY9as14XOa ucUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u23si697951eds.248.2020.12.15.04.32.25; Tue, 15 Dec 2020 04:32:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729168AbgLOMaB (ORCPT + 99 others); Tue, 15 Dec 2020 07:30:01 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:22820 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728606AbgLOMPm (ORCPT ); Tue, 15 Dec 2020 07:15:42 -0500 X-IronPort-AV: E=Sophos;i="5.78,420,1599494400"; d="scan'208";a="102420181" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 15 Dec 2020 20:14:36 +0800 Received: from G08CNEXMBPEKD06.g08.fujitsu.local (unknown [10.167.33.206]) by cn.fujitsu.com (Postfix) with ESMTP id 676E74CE1505; Tue, 15 Dec 2020 20:14:30 +0800 (CST) Received: from G08CNEXCHPEKD05.g08.fujitsu.local (10.167.33.203) by G08CNEXMBPEKD06.g08.fujitsu.local (10.167.33.206) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 15 Dec 2020 20:14:29 +0800 Received: from localhost.localdomain (10.167.225.141) by G08CNEXCHPEKD05.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 15 Dec 2020 20:14:29 +0800 From: Shiyang Ruan To: , , , CC: , , , , , , , , , Subject: [RFC PATCH v3 1/9] pagemap: Introduce ->memory_failure() Date: Tue, 15 Dec 2020 20:14:06 +0800 Message-ID: <20201215121414.253660-2-ruansy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201215121414.253660-1-ruansy.fnst@cn.fujitsu.com> References: <20201215121414.253660-1-ruansy.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-yoursite-MailScanner-ID: 676E74CE1505.A9C09 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: ruansy.fnst@cn.fujitsu.com X-Spam-Status: No Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 block device where the error page locates in, and try to get the filesystem on this block device. And finally call filesystem handler to deal with the 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 79c49e7f5c30..0bcf2b1e20bd 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); }; #define PGMAP_ALTMAP_VALID (1 << 0) -- 2.29.2