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=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 17A15C433E0 for ; Wed, 10 Feb 2021 13:33:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7D94764E16 for ; Wed, 10 Feb 2021 13:33:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D94764E16 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D20116B0071; Wed, 10 Feb 2021 08:33:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CD05F6B0072; Wed, 10 Feb 2021 08:33:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC04F6B0073; Wed, 10 Feb 2021 08:33:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id A33EC6B0071 for ; Wed, 10 Feb 2021 08:33:52 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 75ED61693E for ; Wed, 10 Feb 2021 13:33:52 +0000 (UTC) X-FDA: 77802451104.08.shoe84_491213627610 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 5B2E518387654 for ; Wed, 10 Feb 2021 13:33:52 +0000 (UTC) X-HE-Tag: shoe84_491213627610 X-Filterd-Recvd-Size: 2405 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Wed, 10 Feb 2021 13:33:51 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id BABDE68B02; Wed, 10 Feb 2021 14:33:47 +0100 (CET) Date: Wed, 10 Feb 2021 14:33:47 +0100 From: Christoph Hellwig To: Shiyang Ruan Cc: linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-nvdimm@lists.01.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, darrick.wong@oracle.com, dan.j.williams@intel.com, david@fromorbit.com, hch@lst.de, agk@redhat.com, snitzer@redhat.com, rgoldwyn@suse.de, qi.fuli@fujitsu.com, y-goto@fujitsu.com Subject: Re: [PATCH v3 05/11] mm, fsdax: Refactor memory-failure handler for dax mapping Message-ID: <20210210133347.GD30109@lst.de> References: <20210208105530.3072869-1-ruansy.fnst@cn.fujitsu.com> <20210208105530.3072869-6-ruansy.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210208105530.3072869-6-ruansy.fnst@cn.fujitsu.com> User-Agent: Mutt/1.5.17 (2007-11-01) 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: > +extern int mf_dax_mapping_kill_procs(struct address_space *mapping, pgoff_t index, int flags); No nee for the extern, please avoid the overly long line. > @@ -120,6 +121,13 @@ static int hwpoison_filter_dev(struct page *p) > if (PageSlab(p)) > return -EINVAL; > > + if (pfn_valid(page_to_pfn(p))) { > + if (is_device_fsdax_page(p)) > + return 0; > + else > + return -EINVAL; > + } > + This looks odd. For one there is no need for an else after a return. But more importantly page_mapping() as called below pretty much assumes a valid PFN, so something is fishy in this function. > + if (is_zone_device_page(p)) { > + if (is_device_fsdax_page(p)) > + tk->addr = vma->vm_start + > + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT); The arithmetics here scream for a common helper, I suspect there might be other places that could use the same helper. > +int mf_dax_mapping_kill_procs(struct address_space *mapping, pgoff_t index, int flags) Overly long line. Also the naming scheme with the mf_ seems rather unusual. Maybe dax_kill_mapping_procs? Also please add a kerneldoc comment describing the function given that it exported.