Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1580542pxb; Mon, 8 Mar 2021 00:44:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxOYnqgnrNHOaq+FwUoVFBXwLfo6GzSBaGg2EFGWeULx0S34hadJKZZMvdUoXGtSGn/+/8J X-Received: by 2002:a17:907:1692:: with SMTP id hc18mr13817630ejc.265.1615193076671; Mon, 08 Mar 2021 00:44:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615193076; cv=none; d=google.com; s=arc-20160816; b=hdcrWcKm2mV+nZ80ENb3PBmxnImQJUGXrH+qynevc3ivkrYUfi64du25vS64QDG7I8 oc65rJEMaEmmx52ej2GORyFCakx16tF0Mj9hK7mxHNFRTqmnLNLRLQMnq1ax6f/+tQES 8QsK0QmFN1C77TT2FI70M/Wj4YpOCDWuBwyNOqy1t8wTGobWfIM5mnH/PrwHc/BpfO5w 28Gx8EeYI7QWTZ8jsMxKesMlpC4KuZeqngAqMCT7rNt4tYcGaDrSNThVwRFplwSFGQPM 3Cph+XB5jDIhMzjunRK15XSWvh+S+FGLkr4UQtH9GJra+ti0p3a1IwyEINZPg/fLr/Fo Y4Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4vk8NjZWUWMSC21zZsC5XhaD9emmq9PjiDCa5A5wz7c=; b=eSloBm+vJGuudNoxIcZXrykqEhTywuC3LSOZ+3kmt9M3L8jos+CNgEOpLBBy1dZ68u oD9MVNU6GaU+zKEBh5yM5PnkXJlBFrFlNuPdTbJl0bATxBTqkoysNK06UH0y/zvZiOf1 wqNnwVlOiDQjh+YlnFBP770Tj3HtxbRhRmvaPOanSPNJaXqF1tO8LiDWaJm0NTeG17H0 EaRmJD30OKoE6+rbae1LOJfi8mquRPTs+aRdn7L+cF0BLCc96pNDIGtNbvfzL1iRMyGa INGe6CM72juQylM6ltNqL+cq0tQehVhP6Zhxhjp5FpzuDzqN9hNOrqmkJp+1PijUZphg 7khQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=dmfnCfqp; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y2si6690818edu.245.2021.03.08.00.44.14; Mon, 08 Mar 2021 00:44:36 -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; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=dmfnCfqp; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234308AbhCHFYL (ORCPT + 99 others); Mon, 8 Mar 2021 00:24:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234401AbhCHFXw (ORCPT ); Mon, 8 Mar 2021 00:23:52 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96DFFC061760 for ; Sun, 7 Mar 2021 21:23:51 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id bm21so17679135ejb.4 for ; Sun, 07 Mar 2021 21:23:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4vk8NjZWUWMSC21zZsC5XhaD9emmq9PjiDCa5A5wz7c=; b=dmfnCfqpjw4sbFySyQCvKT/bnV1gdfJE//RwUw+/gEad1qlgdXYzLJo6gW07X7BaWi fOhjzy+D1McnNY1FlfUUZ2eVsZX4PMmPnHHnfvK/QcHbludMlyF7P2E7NSHAbcqrf5gm aJ9t9GCUBUf7zQgOZPuMx/DcsYpEXNWI2O0bdl6RCMydWb7xFXo4rl9dJRw0Qhj5rYcP 2LxgpXUh4l+i7nWNKqBaapAousEIDyzh4EFeoGR7B+xkGxD2oRsrUJHseSmx3kgzJrJn DP5PrPXZJVUI/wFIKhOVGuOZLzXVvn/Osj8paaq9+KZ4pIoYwDefy+eJcO2VWrZ8JUde amxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4vk8NjZWUWMSC21zZsC5XhaD9emmq9PjiDCa5A5wz7c=; b=n9qllvf4pRJUqgiXpNwMtYFU11b2yEcKWfJIs/M3OH2ukR13GHbhEmI/TcGq/pZmbN e4JUbNDdywOmRA4sy7W4Ntuv0X81zNb3kQpBkR8UgwMIcwzbvW+UogC6qWbkrINyr7iJ s8hmc0J2X1ghQVjP0achGdYSdaW5FkFXrSKQsH0H59RjvUPVD38yGnpTEhTP/gcfiK0n P5XiaZf/015xrZXotJ0Fs8bvCxESN7xBVG4XzMK5Ji2aI9k2yjI96pNnAPTSJZvmovVQ lpQccagACfYWn+HFlITi5nVSNWAkHgdQkzt4s/f9Mx/xahmAnSqRqdWABoVTxehWWW+z h4IQ== X-Gm-Message-State: AOAM531MjekYDLt9MLpTZ8K18/Lm9KpCxrVnOprumVIdlIt/mJXjz/Q6 xOJhsW5R6o41Nco9T16Wh/7vz+d90ITKB5RclrLX9g== X-Received: by 2002:a17:906:1bf2:: with SMTP id t18mr13449685ejg.418.1615181030278; Sun, 07 Mar 2021 21:23:50 -0800 (PST) MIME-Version: 1.0 References: <20210208105530.3072869-1-ruansy.fnst@cn.fujitsu.com> <20210208105530.3072869-2-ruansy.fnst@cn.fujitsu.com> In-Reply-To: From: Dan Williams Date: Sun, 7 Mar 2021 21:23:47 -0800 Message-ID: Subject: Re: [PATCH v3 01/11] pagemap: Introduce ->memory_failure() To: "ruansy.fnst@fujitsu.com" Cc: Linux Kernel Mailing List , linux-xfs , linux-nvdimm , Linux MM , linux-fsdevel , device-mapper development , "Darrick J. Wong" , david , Christoph Hellwig , Alasdair Kergon , Mike Snitzer , Goldwyn Rodrigues , "qi.fuli@fujitsu.com" , "y-goto@fujitsu.com" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 7, 2021 at 7:38 PM ruansy.fnst@fujitsu.com wrote: > > > On Mon, Feb 8, 2021 at 2:55 AM Shiyang Ruan wrote: > > > > > > 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); > > > }; > > > > After the conversation with Dave I don't see the point of this. If > > there is a memory_failure() on a page, why not just call > > memory_failure()? That already knows how to find the inode and the > > filesystem can be notified from there. > > We want memory_failure() supports reflinked files. In this case, we are not > able to track multiple files from a page(this broken page) because > page->mapping,page->index can only track one file. Thus, I introduce this > ->memory_failure() implemented in pmem driver, to call ->corrupted_range() > upper level to upper level, and finally find out files who are > using(mmapping) this page. > I know the motivation, but this implementation seems backwards. It's already the case that memory_failure() looks up the address_space associated with a mapping. From there I would expect a new 'struct address_space_operations' op to let the fs handle the case when there are multiple address_spaces associated with a given file.