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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDB9AC433F5 for ; Mon, 29 Nov 2021 07:33:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF3986B0071; Mon, 29 Nov 2021 02:32:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EA39D6B0072; Mon, 29 Nov 2021 02:32:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D92036B0073; Mon, 29 Nov 2021 02:32:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0171.hostedemail.com [216.40.44.171]) by kanga.kvack.org (Postfix) with ESMTP id CEA136B0071 for ; Mon, 29 Nov 2021 02:32:52 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7E09F184818B2 for ; Mon, 29 Nov 2021 07:32:42 +0000 (UTC) X-FDA: 78861150564.02.A247DD6 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf23.hostedemail.com (Postfix) with ESMTP id BDF3390000A6 for ; Mon, 29 Nov 2021 07:32:34 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id EB50468C4E; Mon, 29 Nov 2021 08:32:35 +0100 (CET) Date: Mon, 29 Nov 2021 08:32:35 +0100 From: Christoph Hellwig To: Joao Martins Cc: linux-mm@kvack.org, Andrew Morton , Dan Williams , Vishal Verma , Dave Jiang , Naoya Horiguchi , Matthew Wilcox , Jason Gunthorpe , John Hubbard , Jane Chu , Muchun Song , Mike Kravetz , Jonathan Corbet , Christoph Hellwig , nvdimm@lists.linux.dev, linux-doc@vger.kernel.org Subject: Re: [PATCH v6 09/10] device-dax: set mapping prior to vmf_insert_pfn{,_pmd,pud}() Message-ID: <20211129073235.GA23843@lst.de> References: <20211124191005.20783-1-joao.m.martins@oracle.com> <20211124191005.20783-10-joao.m.martins@oracle.com> <0439eb48-1688-a4f4-5feb-8eb2680d652f@oracle.com> <96b53b3c-5c18-5f93-c595-a7d509d58f92@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <96b53b3c-5c18-5f93-c595-a7d509d58f92@oracle.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: BDF3390000A6 X-Stat-Signature: msu7kbjtc9q71iii6fbm6n4u8oh3gyyy Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=none; spf=none (imf23.hostedemail.com: domain of hch@lst.de has no SPF policy when checking 213.95.11.211) smtp.mailfrom=hch@lst.de X-HE-Tag: 1638171154-255872 Content-Transfer-Encoding: quoted-printable 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: On Fri, Nov 26, 2021 at 06:39:39PM +0000, Joao Martins wrote: > @@ -230,23 +235,18 @@ static vm_fault_t dev_dax_huge_fault(struct vm_fa= ult *vmf, > id =3D dax_read_lock(); > switch (pe_size) { > case PE_SIZE_PTE: > - fault_size =3D PAGE_SIZE; > rc =3D __dev_dax_pte_fault(dev_dax, vmf, &pfn); > break; > case PE_SIZE_PMD: > - fault_size =3D PMD_SIZE; > rc =3D __dev_dax_pmd_fault(dev_dax, vmf, &pfn); > break; > case PE_SIZE_PUD: > - fault_size =3D PUD_SIZE; > rc =3D __dev_dax_pud_fault(dev_dax, vmf, &pfn); > break; > default: > rc =3D VM_FAULT_SIGBUS; > } >=20 > dax_read_unlock(id); I wonder if if would make sense to move dax_read_lock / dax_read_unlock =D1=96nto the individul helpers as well now. That way you could directly return from the switch. Aso it seems like pfn is only an input parameter now and doesn't need to be passed by reference.