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=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 B1FBFC433DB for ; Tue, 23 Feb 2021 23:07:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2DEA1600CF for ; Tue, 23 Feb 2021 23:07:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DEA1600CF 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 A27406B0005; Tue, 23 Feb 2021 18:07:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D6EC6B0006; Tue, 23 Feb 2021 18:07:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C7136B006E; Tue, 23 Feb 2021 18:07:26 -0500 (EST) 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 7696F6B0005 for ; Tue, 23 Feb 2021 18:07:26 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3EEE9249E for ; Tue, 23 Feb 2021 23:07:26 +0000 (UTC) X-FDA: 77851070892.01.23C20C5 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by imf19.hostedemail.com (Postfix) with ESMTP id 28AA090009E9 for ; Tue, 23 Feb 2021 23:07:21 +0000 (UTC) Received: by mail-qk1-f175.google.com with SMTP id z128so425127qkc.12 for ; Tue, 23 Feb 2021 15:07:25 -0800 (PST) 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=VJmC2GvO14hm/b8RU5msbQnds0zY3zW9SDj5y5x2H3Y=; b=lj5FZaKQhah06fiAlKhk441fIO2JGNcgSESN8BvezWdLjy1qrG5FyZTRty7K1eKLdL BvUEdwyPTF0/LlpDWSnBgrs+wCF2OpXIZD8T1Y5wSj6ZlwzP+/Wblg90Izg1nezbX9/0 77sXVyB651RmNsLQgD5oQlI1G/PB8hwP9z07tatXvoN1EZmukciDEGmTLRnNOQuip3mZ K50mQnk71QGgv4qbtwmeGtazEfoONFiU9z2KCaucB7xq63ZLGiKfiyDGrdTbD6YBzkRR NnPo/QaV8TQGk+VICOZ6FA4jcu3aJvPHZ1puj4wwjmEfWnYWEKoJRwwt/fRkwgUPqreQ s8Kw== 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=VJmC2GvO14hm/b8RU5msbQnds0zY3zW9SDj5y5x2H3Y=; b=Xz91sxcJ6XHTuwuo/Sn5IPvJKTEY/CtOGKMq/KbYZF+pM2psHzrR2tz9MUnAzzv07y yDocF+G+iSTOCNrFip5ocaCSP/SPzqsJnO1sPpairMwOeRjvLCw2IEAIeXw/d5XkUa31 32RluPX5yJfLYvn3kRjY+0vSQQVnzU3wPoL+dZGMl4li+ipyxzOldmOy+JqbpjYXwO5k kLKgXVcz4lGFATfYCdHNINKFgAPQVXfC8+R0HG3Hcpmzkg/EbDsdbj42WBrYMpOfTtdy MlurMDbCfbKjDlDW/8Majwp/+z0xD+Ppo/Zo/HIBls3pMIYAT3ZIHFcHIehVswioReBs wENg== X-Gm-Message-State: AOAM532zWDzeIIW9wPCGq5ZOIjnP74qcKoJIDvIWihEaQ6yAzHGbM/2t 6/vEgmaCwGYfDwabQf0CugtJyw== X-Google-Smtp-Source: ABdhPJwFh4qBBCaxqeKESWlTMwi4UT/0HG9EiTNVcxvGoR23omK93HqGgFxhhvFhB3tmfsnfg5vStQ== X-Received: by 2002:a37:9b8b:: with SMTP id d133mr28092705qke.58.1614121645007; Tue, 23 Feb 2021 15:07:25 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-115-133.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.115.133]) by smtp.gmail.com with ESMTPSA id d20sm219375qkb.88.2021.02.23.15.07.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Feb 2021 15:07:24 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lEgm3-00GJZa-QS; Tue, 23 Feb 2021 19:07:23 -0400 Date: Tue, 23 Feb 2021 19:07:23 -0400 From: Jason Gunthorpe To: Dan Williams Cc: Joao Martins , Linux MM , Ira Weiny , linux-nvdimm , Matthew Wilcox , Jane Chu , Muchun Song , Mike Kravetz , Andrew Morton Subject: Re: [PATCH RFC 0/9] mm, sparse-vmemmap: Introduce compound pagemaps Message-ID: <20210223230723.GP2643399@ziepe.ca> References: <20201208172901.17384-1-joao.m.martins@oracle.com> <6a18179e-65f7-367d-89a9-d5162f10fef0@oracle.com> <20210223185435.GO2643399@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: km4riqaidawcmwejt9e981bmnzsjp4hm X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 28AA090009E9 Received-SPF: none (ziepe.ca>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=mail-qk1-f175.google.com; client-ip=209.85.222.175 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614121641-323269 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 Tue, Feb 23, 2021 at 02:48:20PM -0800, Dan Williams wrote: > On Tue, Feb 23, 2021 at 10:54 AM Jason Gunthorpe wrote: > > > > On Tue, Feb 23, 2021 at 08:44:52AM -0800, Dan Williams wrote: > > > > > > The downside would be one extra lookup in dev_pagemap tree > > > > for other pgmap->types (P2P, FSDAX, PRIVATE). But just one > > > > per gup-fast() call. > > > > > > I'd guess a dev_pagemap lookup is faster than a get_user_pages slow > > > path. It should be measurable that this change is at least as fast or > > > faster than falling back to the slow path, but it would be good to > > > measure. > > > > What is the dev_pagemap thing doing in gup fast anyhow? > > > > I've been wondering for a while.. > > It's there to synchronize against dax-device removal. The device will > suspend removal awaiting all page references to be dropped, but > gup-fast could be racing device removal. So gup-fast checks for > pte_devmap() to grab a live reference to the device before assuming it > can pin a page. >From the perspective of CPU A it can't tell if CPU B is doing a HW page table walk or a GUP fast when it invalidates a page table. The design of gup-fast is supposed to be the same as the design of a HW page table walk, and the tlb invalidate CPU A does when removing a page from a page table is supposed to serialize against both a HW page table walk and gup-fast. Given that the HW page table walker does not do dev_pagemap stuff, why does gup-fast? Can you sketch the exact race this is protecting against? Jason