Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp453953pxf; Thu, 25 Mar 2021 07:41:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLJmNNjAMCvxHHkUgBNbhbjal7Tt6OFBBgunYgCdXkhP8WvJtq/uQ+VmxEIUvsoCfW7Eof X-Received: by 2002:a17:907:75d9:: with SMTP id jl25mr9562389ejc.452.1616683265225; Thu, 25 Mar 2021 07:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616683265; cv=none; d=google.com; s=arc-20160816; b=oRoWcxYRc1EoMQ+aBhMvFPxPTrjWN+BFwFjr4r/z0GmNFHAYtXd3iNLYZfE9sz4ghF c+gFRwkjunaeKjyK5m9+BoSIfgexK00nxIH48umAudUnlt04cwlvn0jDOtaIg37EyI/8 NNQzEO5m0IOx6hNFI+Vj7IrtjTGUOITIVygvvhBiRzA+cmniO8Ah6TG6vufsvye+HIsM mw1SJqTxO9nYMA88bmmstDjqHu3uHwILdakgvryTMrLcuQEm06YujOahyDp5easNil3f FeAdxTLBPYVwSNUqbXxhq/K39h5NBoaC+xI+2ifjfeAIMQVN+cd2j9NVd4QJ2kdlMnsQ IB8Q== 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=yUUY0ROAP+SLb7HLoPQ+wA8YpHFO9kWKGRbvh/B/IQ4=; b=vUp6EcIcgmkf6RQFI3hEXi8d+Go1n1sg4otUQrvHS5CKtuUljR6IrhYhX1MURfix/o s5oGANoXrOJodJibzGRxASowp7tZkipUGJOtiVRO8kdR1ye6URrO9aEle37kg8MR7OOi MBTnzZBL460GwsQICd17+dp0ce9VwXn+2JqhaYy0inbzXHcSh/GPDiKGZ0PPM2OI/Q00 /GlQEanOpjJed8lBhSKTGfdg44U1RwV0cRA7TrqMq1Aj93RSypTMjxlNP2L0cWXVTPaL cskf0YZ6m1LuccxxAhIXtQEcTr8x9Ais0eucDBrBelkR4/KnmVXkj+zVRBJMT9zr8YMX e/wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=B8UZG840; 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 cd26si4352791ejb.473.2021.03.25.07.40.42; Thu, 25 Mar 2021 07:41:05 -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=B8UZG840; 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 S231305AbhCYOho (ORCPT + 99 others); Thu, 25 Mar 2021 10:37:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230416AbhCYOhd (ORCPT ); Thu, 25 Mar 2021 10:37:33 -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 80AACC06175F for ; Thu, 25 Mar 2021 07:37:32 -0700 (PDT) Received: by mail-qk1-x72b.google.com with SMTP id v70so1937718qkb.8 for ; Thu, 25 Mar 2021 07:37:32 -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=yUUY0ROAP+SLb7HLoPQ+wA8YpHFO9kWKGRbvh/B/IQ4=; b=B8UZG840ltXLZaJ3g7LqogpLPEEKfgbMjrJ+zqNNPxJFW3SGTOScgcllhOu7YgBiL0 oporCVsfZXMbpB+i5+qwq3P9pQ6m4/ILUksomJ3JDUrEDpKJEoSd+zwc9zdQws6pOrSp gdAEyFuujj8Ult+YZO/Z6hMyiwU00dKvEMmYn+fpqpFK1LlznqaiZpHQWU5kb3PMezAh puXp0II/Ux5PIo5ANTztzOO8ZU0pcnupnz2W1xCq3pqg9BPJFH0DUsI+17n7p+JUvnNB eIh7WUvmxjS6vre84wz62VYvBU+QKcvvJO1+1vVU/57P3npxdBkRBBwPOwYPwIgJmsmB iBtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=yUUY0ROAP+SLb7HLoPQ+wA8YpHFO9kWKGRbvh/B/IQ4=; b=ZdpY/8/WfgCOjWYJHxUp67QBqEDj0HvmT+naZ0BW0UI/YNjXtMRWrnd7vjcB8ZgFC9 HkJ4Qc4KggWFbOm5wRQ+yBloCsAsiNsV3WS5k6cNNg0rj5T4cZv1NBqdX1GUZza61LVx EvaE5myTjoYS4fOfZdzqhAGj0HAB/Bh1+qrsxFLmJsiPPX5iPuw+2ijerGwwW6d/iNqa TQoSrLmLiBVwlm/9bvlj7QJhbTb5sFTPL7z5zuFZbbSN2JJOd7K72FN6aOhrr5m53jqH YZ4mwnmIgFCHNQ4srXHLHEIhoCAXBGCCaeNEa2vF9KugV5Uzyz0F1YBacoBT6JuUPePM fJew== X-Gm-Message-State: AOAM531LP5Hqj4GK6uxg9Sb/EQzkzKxm823tzm7vFBNzAkU23n+WST1S 9yO17WpZ/k+GFp9xHtOUDXxMzg== X-Received: by 2002:a37:2785:: with SMTP id n127mr8496495qkn.320.1616683051840; Thu, 25 Mar 2021 07:37:31 -0700 (PDT) Received: from ziepe.ca ([206.223.160.26]) by smtp.gmail.com with ESMTPSA id g6sm4269899qkd.62.2021.03.25.07.37.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Mar 2021 07:37:31 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lPR74-002fqr-7U; Thu, 25 Mar 2021 11:37:30 -0300 Date: Thu, 25 Mar 2021 11:37:30 -0300 From: Jason Gunthorpe To: Dan Williams Cc: linux-mm@kvack.org, linux-nvdimm@lists.01.org, Christoph Hellwig , Shiyang Ruan , Vishal Verma , Dave Jiang , Ira Weiny , Matthew Wilcox , Jan Kara , Andrew Morton , david@fromorbit.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] mm/devmap: Remove pgmap accounting in the get_user_pages_fast() path Message-ID: <20210325143730.GL2710221@ziepe.ca> References: <161604048257.1463742.1374527716381197629.stgit@dwillia2-desk3.amr.corp.intel.com> <161604050866.1463742.7759521510383551055.stgit@dwillia2-desk3.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <161604050866.1463742.7759521510383551055.stgit@dwillia2-desk3.amr.corp.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 17, 2021 at 09:08:28PM -0700, Dan Williams wrote: > Now that device-dax and filesystem-dax are guaranteed to unmap all user > mappings of devmap / DAX pages before tearing down the 'struct page' > array, get_user_pages_fast() can rely on its traditional synchronization > method "validate_pte(); get_page(); revalidate_pte()" to catch races with > device shutdown. Specifically the unmap guarantee ensures that gup-fast > either succeeds in taking a page reference (lock-less), or it detects a > need to fall back to the slow path where the device presence can be > revalidated with locks held. > > Reported-by: Jason Gunthorpe > Cc: Christoph Hellwig > Cc: Shiyang Ruan > Cc: Vishal Verma > Cc: Dave Jiang > Cc: Ira Weiny > Cc: Matthew Wilcox > Cc: Jan Kara > Cc: Andrew Morton > Signed-off-by: Dan Williams > --- > mm/gup.c | 38 ++++++++++++++++---------------------- > 1 file changed, 16 insertions(+), 22 deletions(-) I'm happy to see this, and it is really the right thing that PTEs are properly removed before anything happens to the pages under them. Reviewed-by: Jason Gunthorpe Jason