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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, URIBL_RED 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 3DF71C433DB for ; Thu, 25 Mar 2021 14:37:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D5778619FC for ; Thu, 25 Mar 2021 14:37:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D5778619FC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 648176B006C; Thu, 25 Mar 2021 10:37:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F8176B0072; Thu, 25 Mar 2021 10:37:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4BFE36B0080; Thu, 25 Mar 2021 10:37:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0125.hostedemail.com [216.40.44.125]) by kanga.kvack.org (Postfix) with ESMTP id 2F2AC6B006C for ; Thu, 25 Mar 2021 10:37:35 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DC880284BD for ; Thu, 25 Mar 2021 14:37:34 +0000 (UTC) X-FDA: 77958650028.10.F2A6F6C Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) by imf19.hostedemail.com (Postfix) with ESMTP id B75E890009EC for ; Thu, 25 Mar 2021 14:37:29 +0000 (UTC) Received: by mail-qk1-f181.google.com with SMTP id z10so1913760qkz.13 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=R+lTMBHyD+DCWv4Ntu3kPZ7fmUwlvOISHYG0WinnDYm6STb9RNqQKLnuxxvu7yEonv wEj50zuhmn1W4SD3WTyjmuW/Df2DufZZlR34De2GfrKrpAJN3EG5MeaKhR/Wkl6f/vHM 3W48FCINrjmqyR3JruRiNQkhNB4KAY4Nq95E8UH9COjfkxVcC/Vbzse1Nd6k88YVFyux svqgXxacO2BodwKpc8vsEqLjd0UukoEbH+L1VWcI1CNdtgYe54/VLR3kKErgkbe/OHVt rxbgyxwg4vOGjTYice9U4z2BheDG+hy4a69dm2fcQyY0pZ1bivA7x9eCOxuwq8Ut3xhB 3Syw== X-Gm-Message-State: AOAM531AnZseTcZCIRFy8aUv7/vSStacaL54E7bIlr2XqZ9Lfkk71nYg DPaDGVmt0jJH8fcHbmv2HhEoag== X-Google-Smtp-Source: ABdhPJxxJrqA/cHtDo5IXqd0JMRtMBxMRmcICARR+0tz9w078q1svpjeQewlY8ZmShsZXpobmfQbSQ== 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> X-Stat-Signature: 3se19kndeh8p3kewixgzf3haj83x773a X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: B75E890009EC Received-SPF: none (ziepe.ca>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=mail-qk1-f181.google.com; client-ip=209.85.222.181 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1616683049-615378 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, 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