Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp670493pxb; Sat, 6 Mar 2021 12:42:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2W7D2XMEKNkh1qRJUmZmd2XPy36PtPxjaCk8fPZQvbkUUB3Ppp8JEQLzzjDDSuE8FEl9Z X-Received: by 2002:a05:6402:31a7:: with SMTP id dj7mr15351243edb.33.1615063324699; Sat, 06 Mar 2021 12:42:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615063324; cv=none; d=google.com; s=arc-20160816; b=I7uXNFhlR6hNb7uRKq9UlyUEQoUXsvd+b3cr0Cbuoik5XspYRSq1gazt0j/gqcLatx kBcnxL03aAD+Qr+iBIU1aAdDMoR14Gj5ikG+sB1BZ1XuSoKii7HWGpuEX8Fo7/NRDUVs kf1u2wuPUOsVKmm9c5f4ddoJ+nm6rLHRysvyinmbRujyTow8ZfXWJOd6JjpYY1ZDHpqS /SlbqsGkc12MWtGJDDJcPHAnRxYoNqEhq4c6DBW1niWDyCE0nElkwCjhGFhdQ7HObMi9 bjtLVzBwNyZzYCflVONbLaSiXuo6KWRwwiq1zoR+oLrdIu49V0UBfFW8/sxsdrbUEvHV 25hw== 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=bVBJNOetXrqKceA6PQT3AoaWCMo1uBzTwNd40e3p5Mg=; b=d3udjMc0KgEkT5dnPJ7llOSrfZn5l55KXl/sfD5XWJ1XPp+F/sk0rSBpFT1QVizBo7 WUDR8Ugr52sl7cBukB7IJ3es52eWvIJ5S0FOlneF2vmHRxDTc457xJq3zdrXJjOgxxH4 xaMMSi6XNYjdO/wLV3eGTKYtUgKTWF0jwx1T3nz0QCMNaZZl3byqhEr3uQ/5F3+A+kbN 4Ci6HxLXoslTbL5Vu3OieVsangMnAuvYphF/qPN0LuL22ByWPjh+/g3MkqmY64OMpLQc /yUwEtGqlVdETiUw+rp4u8Uz9O5xzuql8/hAiBpF9tvZGJJGk4Rwq88xiqDNePPuMM5z P9aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=DUH2TaJD; 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 h17si4103575edr.331.2021.03.06.12.41.42; Sat, 06 Mar 2021 12:42:04 -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=DUH2TaJD; 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 S231451AbhCFUhA (ORCPT + 99 others); Sat, 6 Mar 2021 15:37:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231438AbhCFUgq (ORCPT ); Sat, 6 Mar 2021 15:36:46 -0500 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 671C7C06174A for ; Sat, 6 Mar 2021 12:36:45 -0800 (PST) Received: by mail-ej1-x636.google.com with SMTP id jt13so11595583ejb.0 for ; Sat, 06 Mar 2021 12:36:45 -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=bVBJNOetXrqKceA6PQT3AoaWCMo1uBzTwNd40e3p5Mg=; b=DUH2TaJDmYKl3P+nqyQnZD/L+UUehgvGZ+JdR6f29HgDHqUZMlDctwBIl8mYEmOyr0 N4JfiYpVnsK20wsamLI2lVHA89Wfq08BTq5pazwlWEnowiN+pvdoMlOFkXMkezTctVU6 yLVLH/j9zqqOc1XXIzlPNblcwaWBnvPKoE+8ygaflWqyueqL8GQUxJqDZ0IOPsbLAq4D ClAITvBD9MRRxeIdqI+0cvIdl865zgrrN5mPPgRQlFQTjJcqKYMYzsPzMflqD2WkyucY yYqxvUtScFD3cWQ3k6qWXggCW2IBUYcSUf7R3K/wcLL0Zz3r5yXY54vMvwFWm819EQIv 72nA== 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=bVBJNOetXrqKceA6PQT3AoaWCMo1uBzTwNd40e3p5Mg=; b=bXtfFHAE5n0jW+2p25j8yo3V6i3lsiK11T7SHg395sPZuHnx4GdHPXjhS8sjCTeRlf 47Xq9+PbryAGyLXQdQJFUQ7oxiC2RJ2vlf4Pc1tGQ/AOlMmmsUsKBg8d2ggUX32a6V0A F2lTP4wuuzsCmdh21jSmwebKU/8uYf6issi/8t4rgVlSwwNUOt0Id/bUruFcBIVU/D/z YH13glAyjfoexSONmkg6jIqcLlTXieVFiwph79983JQcgEL5/97ynareWBVTblB5KlY5 K2bvHhhrkhadEmQRrPfexVoPaH68qzpMr7ocqB4mov8FgkaQIQJ2Yo53GfdFihUxz7OL fQDA== X-Gm-Message-State: AOAM533YePQ6vQAsCsAAd0KbKpEBzjbbD1jNq4cvEHpYbU3vZkUsd7MC Nzu67ypH7+aJZIEGrOYkV+7//dNpo5CMAiyiOSjDdw== X-Received: by 2002:a17:906:2818:: with SMTP id r24mr8202331ejc.472.1615063004125; Sat, 06 Mar 2021 12:36:44 -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: <20210208105530.3072869-2-ruansy.fnst@cn.fujitsu.com> From: Dan Williams Date: Sat, 6 Mar 2021 12:36:39 -0800 Message-ID: Subject: Re: [PATCH v3 01/11] pagemap: Introduce ->memory_failure() To: Shiyang Ruan 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, Yasunori Goto Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Although memory_failure() is inefficient for large range failures, I'm not seeing a better option, so I'm going to test calling memory_failure() over a large range whenever an in-use dax-device is hot-removed.