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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0629C433FE for ; Wed, 29 Sep 2021 22:48:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 702B461440 for ; Wed, 29 Sep 2021 22:48:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 702B461440 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 0ACAF940065; Wed, 29 Sep 2021 18:48:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0350994003A; Wed, 29 Sep 2021 18:48:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF168940065; Wed, 29 Sep 2021 18:48:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0053.hostedemail.com [216.40.44.53]) by kanga.kvack.org (Postfix) with ESMTP id C963494003A for ; Wed, 29 Sep 2021 18:48:34 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7F93518000FD5 for ; Wed, 29 Sep 2021 22:48:34 +0000 (UTC) X-FDA: 78642101748.28.0DD6231 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by imf09.hostedemail.com (Postfix) with ESMTP id 2FACE3000115 for ; Wed, 29 Sep 2021 22:48:34 +0000 (UTC) Received: by mail-qk1-f174.google.com with SMTP id p4so3970110qki.3 for ; Wed, 29 Sep 2021 15:48:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=B0sV1qVbbjrF0PysKkzPgbfO3+Me62Wpz2WIVsVwuoE=; b=P9N1xixIbU2CQZqPgthtCxabWVb1WaKJas+T5Bbtlr4fD7rztRWCIEl7HQ9hsYT8aF 41wF7TSRaJ3f9seP9f0KrtpHt8gvV/9kf7XUzRs3fIottSWd5Jos1b7FSN+JKsFTdWUh cQmc0BxR1at5W66It0VtetEvP3kxr6TgFG71lefSWpCHrqHfP2E1T4XXYFzcdwOAnPpb WlKs8E3Ae/btD+bQUn9uA6WCV6uRLRFmutfEb0Vg/FCMMltR8qwOKBC/i/xs0Mi5ciI7 QAuN+ydzCbvdhC6HuPboTTSd7wkOyLMNyDUAGQreZfH9ZakjqoboD9OYItawKLMdXBtS NwMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=B0sV1qVbbjrF0PysKkzPgbfO3+Me62Wpz2WIVsVwuoE=; b=cyLYRHopXGWIoI/MgTb3dFr5eGqlpBnewC4wmD3g4FF9EsvdmBRi1H/V911iaCRqeq 9stIotdBUpum3reRRQRXP8TBzNvqQn52DQgI2eE8FD5JhtZY1wzuESYtFH5fFKKodfuV 0Gbn0GDGCTW7bwVQVEv4jf81Ma9jboHzWnKGuK/ESUS/T/2sNuL/Wa6GhGd7jRD3JFpb kAr5t8KGAmum2hj6Gd6BOvdVyH3B2j8JNiff8mhirEiU9TPMic3LVbIxXc4Z/tkYPo5B +fVVqPKSS34WcXv4L1uzozKD4XYnxH9PfYtIFiK95c0FfnIjAkGKr5geZsVvYbz7sLDH YCdA== X-Gm-Message-State: AOAM532Wr+q4IYMiTdX1DH86CG+J1cCxAC+isR4LifoV5LqLqyD2iljE Ne6xEQ7mMAIbTMSsZKirP03wLA== X-Google-Smtp-Source: ABdhPJzspya2uDxnOQP6RHXKg0GJNOh86aMtX4Pki+BqPF0YRta2WtTuRpyPIif49H7Hs8Tu/MZ3xw== X-Received: by 2002:a37:8ec6:: with SMTP id q189mr2083152qkd.145.1632955713476; Wed, 29 Sep 2021 15:48:33 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-113-129.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.129]) by smtp.gmail.com with ESMTPSA id q14sm748591qtw.82.2021.09.29.15.48.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 15:48:32 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1mViNL-007i7c-U2; Wed, 29 Sep 2021 19:48:31 -0300 Date: Wed, 29 Sep 2021 19:48:31 -0300 From: Jason Gunthorpe To: Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, Stephen Bates , Christoph Hellwig , Dan Williams , Christian =?utf-8?B?S8O2bmln?= , John Hubbard , Don Dutile , Matthew Wilcox , Daniel Vetter , Jakowski Andrzej , Minturn Dave B , Jason Ekstrand , Dave Hansen , Xiong Jianxin , Bjorn Helgaas , Ira Weiny , Robin Murphy , Martin Oliveira , Chaitanya Kulkarni Subject: Re: [PATCH v3 14/20] mm: introduce FOLL_PCI_P2PDMA to gate getting PCI P2PDMA pages Message-ID: <20210929224831.GA3544071@ziepe.ca> References: <20210916234100.122368-1-logang@deltatee.com> <20210916234100.122368-15-logang@deltatee.com> <20210928194707.GU3544071@ziepe.ca> <9c40347c-f9a8-af86-71a5-2156359e15ce@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9c40347c-f9a8-af86-71a5-2156359e15ce@deltatee.com> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 2FACE3000115 X-Stat-Signature: 3pzcm8j89ogyucz4e5pj7dw3dp96m4fp Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=ziepe.ca header.s=google header.b=P9N1xixI; dmarc=none; spf=pass (imf09.hostedemail.com: domain of jgg@ziepe.ca designates 209.85.222.174 as permitted sender) smtp.mailfrom=jgg@ziepe.ca X-HE-Tag: 1632955714-598849 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 Wed, Sep 29, 2021 at 03:34:22PM -0600, Logan Gunthorpe wrote: > > > > On 2021-09-28 1:47 p.m., Jason Gunthorpe wrote: > > On Thu, Sep 16, 2021 at 05:40:54PM -0600, Logan Gunthorpe wrote: > >> Callers that expect PCI P2PDMA pages can now set FOLL_PCI_P2PDMA to > >> allow obtaining P2PDMA pages. If a caller does not set this flag > >> and tries to map P2PDMA pages it will fail. > >> > >> This is implemented by adding a flag and a check to get_dev_pagemap(). > > > > I would like to see the get_dev_pagemap() deleted from GUP in the > > first place. > > > > Why isn't this just a simple check of the page->pgmap type after > > acquiring a valid page reference? See my prior note > > It could be, but that will mean dereferencing the pgmap for every page > to determine the type of page and then comparing with FOLL_PCI_P2PDMA. It would be done under the pte devmap test and this is less expensive than the xarray search. Jason