Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1575072pxb; Thu, 28 Jan 2021 22:31:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7fip9UJhjs5J9hOicUNowJFti9RyD6a4T6D0W/X94ya3X4V+gu5UbuijhH8uLGcj8p9vI X-Received: by 2002:a17:906:ecb3:: with SMTP id qh19mr3033698ejb.113.1611901873642; Thu, 28 Jan 2021 22:31:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611901873; cv=none; d=google.com; s=arc-20160816; b=LkSidC+Fulp+PIyC35Ktmry/sZDOysoBgPD4pWXY56SlPXKaVCVB6dFK8/5DmwlRqD zuja39wUBQYNk71dZh7bn4CJSHG2mfmOPiUhQLyb+viuVQN99avW+YCqEVn1cBkE/m0n WdearoQSj8kkv717lMWrYW+iwhafGhZeXOl/AmBtjOixLbAp2/GITDbzbL2aEq1X91pK U9MxnPBCWsJ4AazPL7uMYjGDW6CK5QIcdhq7Fp8toUK+g8liLJYE6iPWa/v2KWMYgRdW mHOgUQe02MnNF9goLAH7zDbW2QGuNavS+a1OOAc5dv/2sx8F9w67CGkUxInfROqFOz/A qL1A== 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=DUL2MKUj0/ESBOwbvsBU+Y4ruUZ/zXWW17hhPU9vMLU=; b=ibzcyPMHi58SFuDy26taxUgwxdrr2yFw3Ei4+ApiuALO3lf6nSdBZLMyP4rpAmE78F k1UVDd5jo2qlUIN2U3IVU7YwmVxgURuKjXVIeVniUrgBuk3w/0UNzIsb0hjhGWFjEOIq yiw3Khp5petAAcfzTXEli1PWv8N9I1p66OTkNIdqDUXe4QtQuZ2hdeJVePbGux7mO+bc nMf1tdyE5f7OKIZTk8m4shDEjOHg7JeYrJ+TVSm2vORkfCdcxjd/+c8rYTJbF5Ev3tj0 63+TVXKlQqA1e/w2RBfqdlVCZhIvRrBVi4EGzIVtr6AnH9J3RRKPYwGhVVjBJ0flMtU4 d5cQ== 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 y6si4879843edp.379.2021.01.28.22.30.48; Thu, 28 Jan 2021 22:31:13 -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 S232146AbhA2G3A (ORCPT + 99 others); Fri, 29 Jan 2021 01:29:00 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:4875 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232069AbhA2G27 (ORCPT ); Fri, 29 Jan 2021 01:28:59 -0500 X-IronPort-AV: E=Sophos;i="5.79,384,1602518400"; d="scan'208";a="103973620" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 29 Jan 2021 14:28:05 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id DEC524CE6787; Fri, 29 Jan 2021 14:28:02 +0800 (CST) Received: from G08CNEXCHPEKD04.g08.fujitsu.local (10.167.33.200) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 29 Jan 2021 14:28:03 +0800 Received: from irides.mr.mr.mr (10.167.225.141) by G08CNEXCHPEKD04.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 29 Jan 2021 14:28:02 +0800 From: Shiyang Ruan To: , , , , , CC: , , , , , , , , Subject: [PATCH RESEND v2 01/10] pagemap: Introduce ->memory_failure() Date: Fri, 29 Jan 2021 14:27:48 +0800 Message-ID: <20210129062757.1594130-2-ruansy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210129062757.1594130-1-ruansy.fnst@cn.fujitsu.com> References: <20210129062757.1594130-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: DEC524CE6787.AD489 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.30.0