Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1052034pxb; Wed, 29 Sep 2021 15:58:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymXjZPXRE4hLfTwPRNchAsyUMkFvAIvctNg779BUTwCApWZwdBibQ+M1R17VyOCLifEzBx X-Received: by 2002:a17:906:b1d5:: with SMTP id bv21mr2900319ejb.346.1632956290403; Wed, 29 Sep 2021 15:58:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632956290; cv=none; d=google.com; s=arc-20160816; b=VWGmRrljtHs077AsC6CrfTysTaWK6Xruvmyw7KovDV99e7g22tr51YauSdpjd6MISE DDpWuDeEoJ3jEFXfaaXs6ruWzUxPwAf70qzpx41fG+FnSxtEoreZ3UwHh7mnJM40rTft +GFt4FxjB99Qd3/RHLAlra2ET7zxk3z1Lmd74qdHJ9r0QA7qR6zKKrC+ZU4x6xU6Bsmc I8z4lQiHep1sLzdFzyHbzGZqpYeMfM5Mf+4s6yOw3GViNye6eW7fCHnbMn1/88Mn2xvk IHQfihXMUbAawg6qXOVeK3gey+ce9AiTvXNdx6KYOJtKvz8ZRieEEMMiY511WOSm0+5r 5npg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=B0sV1qVbbjrF0PysKkzPgbfO3+Me62Wpz2WIVsVwuoE=; b=NFBi28NMxjzKbe1AJtmyd02X0S0RsdAlWDaEo/VAkzY7jxQMKNyM3edQeFkLCBX+kc 8KRCUiNA1dX1GbfO4SE68qwfL7qGwwNV/8skmZHP1SxrrMS31Nx7KNPvZUSnilcYtzvG KJax7Q4lWUkzidpxJgdwjG4QyP30sV8+2YC/9EpHxnYouz7gscJTaeWT+yXytyEurNnA wX1YpEeySbO1QU4lkSya7ovtfIF4H/7DUcEAzkXDhpt/3J46qwEbny/02gbmcpYykRB3 qDZMEj8x4RDhvx3w/t9ZvpKtiMS5B5wpvRims0BU0P5X1lJL5WnKmC0kTInBb4CWQZ2H kngQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=P9N1xixI; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v2si1384822ejk.783.2021.09.29.15.57.46; Wed, 29 Sep 2021 15:58:10 -0700 (PDT) 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=@ziepe.ca header.s=google header.b=P9N1xixI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347359AbhI2WuS (ORCPT + 99 others); Wed, 29 Sep 2021 18:50:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347354AbhI2WuQ (ORCPT ); Wed, 29 Sep 2021 18:50:16 -0400 Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A77DC06161C for ; Wed, 29 Sep 2021 15:48:34 -0700 (PDT) Received: by mail-qk1-x72b.google.com with SMTP id 73so3968493qki.4 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=MXDtNyryNtcBmV7y5lM6erzjbGglBbeSxivSmTzG7qXh4L1QYlyA+EsaFnQjTVoUWj cWX9VgDxUP2D6I/sp0DJ9GK8k6wslRSghMfaEEoHXtJHbOUy+xLl6slmoautzIAsgrbJ hjCaYE6LplHm/kyt/oLE+yTJheUJd6Myo5UjUzzFzChF4+ND2/sbtG2D5SyFOCKI59TY fyRem4cDmrO4YzWyQG+hWdHynWgMqRxsZZLE+fpsez085VUvH+8huqjzUl6YAcLBVUE6 nZHPiYlHiBHNy2JQtq1sUJUtg+Ds56xldAeJ7HrXbaNRlZACa1U5+jYZ1ce/SdZHm+yq fFhw== X-Gm-Message-State: AOAM530KohacpsnhE5CVOQXCSTuvbOTWu+t7XbsKsB9wIfoUBwlGThT/ je5IbnoAzMzTnPrAO5zUpHBS7Q== 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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