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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 910CBC4345F for ; Fri, 26 Apr 2024 13:45:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC4146B0083; Fri, 26 Apr 2024 09:45:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E4C956B0088; Fri, 26 Apr 2024 09:45:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC6CC6B0089; Fri, 26 Apr 2024 09:45:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AEBD96B0083 for ; Fri, 26 Apr 2024 09:45:09 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 66D2CC133E for ; Fri, 26 Apr 2024 13:45:09 +0000 (UTC) X-FDA: 82051804338.17.8A73476 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf09.hostedemail.com (Postfix) with ESMTP id 29E3914002F for ; Fri, 26 Apr 2024 13:45:07 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SLjYxEjJ; spf=pass (imf09.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714139107; a=rsa-sha256; cv=none; b=ptiqyjZ/HOH9ndPm8e+tkSO6rxR0f2kXDxpAcFDPololxj6SsR0Zn8vlAGTPiqpqwyXU6v Tul3FGuqe9Uw8/CW1QGGB9jk6vxcxXjLKQwps2xKtm88j+8Ion/8Q9PyBxE6ARKnIegUCR XhW6ynT4eoil6pPDflWIy6UxgIOwNDA= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SLjYxEjJ; spf=pass (imf09.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714139107; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uF1kPlR2Ck3Z44kTNMrT7zanJ3tMGvooilBaXGx0yJc=; b=ZlmkLJIcfuwmhkFb1xxVFsuok8HoZBiciXxp3YR5nZB8bKSSRIAR/JDFh8Qokgw0y3Vv4I rObRb3p1qJVp229FPPq5JC0Jcx/X/u/CU8uSTHGe0Hd1fOTXZQAI/XAmLWUpeMbIu2+cMM J6kTbXvD/hIyZWhggOD7R6+lm5tYsvw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714139106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uF1kPlR2Ck3Z44kTNMrT7zanJ3tMGvooilBaXGx0yJc=; b=SLjYxEjJg5uLqSYy+YmAiMlkMQJei3OZDsNWgUrL0FKYMHIQmdtzYuKMK8zMMh67IZtVp0 fRAoYxJldbWCTyMCJpkY7DfOF8e6fASI9uR5RVTFv3rZHS3vZct8g+ChXsFkb6flxfUjpM TaCig0ogs0SJ4b53fU4C7swFbNwxN3M= Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-483-d_d3_XptM-WGAqAzmO6KeA-1; Fri, 26 Apr 2024 09:45:02 -0400 X-MC-Unique: d_d3_XptM-WGAqAzmO6KeA-1 Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-6eba7dc8f1dso582669a34.2 for ; Fri, 26 Apr 2024 06:45:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714139102; x=1714743902; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=uF1kPlR2Ck3Z44kTNMrT7zanJ3tMGvooilBaXGx0yJc=; b=LLiKZhfysZ+7hJKOxWQ4CkocqWQBcDSqE+bR1+QvtXe2h8Nr/d++SDrgQVCsTaQYEE ZTGhf20NMJbJEiaEHwJ7ypDa6kp6gxCqtlpCruyhKqrl8Py1FfFD2ypxpp6TWJ4RFFA2 ES3pifr+jX12lZCVW26HUV3CBkjZFyd1gG5X2ak/JWKH62C6nn5B243IdR0ZDhHWFTvK 0PaMYlYtxLZOV12s6+glLbFY17Gj/wayRZKyLVem64yt2x+9gueTm8w8MFePD/j+0jMH Ul9jiJ+SYu2KADt4EqKynsMl+Z25CCKZ2gGVsCfG/OxEf9DpQEqjwWyQUS2pbB5PPTYY YnrA== X-Forwarded-Encrypted: i=1; AJvYcCWgSkSg4L/TaWAzBb35pWp/p6grvE+6i57Ld2YJtXwnl3yH6jVBPksHdGlIiCJjHUfT7eylkdMvlrAscoy/KETbhZw= X-Gm-Message-State: AOJu0Yz8/5z+reRYeJh0HvZyUCO9DLoRLTyHUBAeqXi5V7+2owOdLwL+ CWxBbrtqevJXD98Ai1bv8KAsYk9z+CizXmWrOtKenXXb2jYjfbxBz7hvD16wuapxQPRQMLtFIJ+ lF1AfMfj8chYE+oBF0X0XusWK37JORPFCzGcl8uin1p2Z/gBR X-Received: by 2002:a05:6808:d53:b0:3c5:f29a:5fda with SMTP id w19-20020a0568080d5300b003c5f29a5fdamr3101415oik.3.1714139101694; Fri, 26 Apr 2024 06:45:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzrxrCF28uWDRUo6q+zp4qFvioOS0q1e4hOagwn8iRvVD4UFCuaQuTxLkqj/Vp49yVezlG5g== X-Received: by 2002:a05:6808:d53:b0:3c5:f29a:5fda with SMTP id w19-20020a0568080d5300b003c5f29a5fdamr3101360oik.3.1714139100964; Fri, 26 Apr 2024 06:45:00 -0700 (PDT) Received: from x1n (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id w9-20020a0ca809000000b00696b1050be8sm6864026qva.133.2024.04.26.06.44.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 06:45:00 -0700 (PDT) Date: Fri, 26 Apr 2024 09:44:58 -0400 From: Peter Xu To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Mike Rapoport , Jason Gunthorpe , John Hubbard , linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-riscv@lists.infradead.org, x86@kernel.org Subject: Re: [PATCH v1 1/3] mm/gup: consistently name GUP-fast functions Message-ID: References: <20240402125516.223131-1-david@redhat.com> <20240402125516.223131-2-david@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 29E3914002F X-Stat-Signature: g5id8ukh5rkp5ibrt4qwpmqu1i7khhim X-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Li/ipGka4M7GMEuVZMRdaTHoiaXsTuZhmWcIVGf65Wxg1BJMjAQNEpwZ6/TbdzrHR8Vv02JurK3wiJ9akxIaKmMBYX8aEZSs0/PqVvs+c1zqz2f5X9d+mUInucBzZkMH7Zt1Ui1EFpMLIkQg1L2feKpcrLZMlFA319S0MHF4UevbnHWKhuF/F+e4rghuN+D/u/rJAHHrA2Fdn1nxwDUOL+fEMltHUl20vpEOmOJtAy+Zxs01tYfvGAZex6sQy2n2n4zoP7O1EIjUlZZtiFspL8nq8muLNj41pbXSltBWent/9wS9O8SSUNFHZ6SsUfQvAZIDx21jh6hOzzDcnLhPsHazkd0/01OS2d5n7KDNDs9HrNEtEKFWKwK6fbpeA4KqQ7cQate4O8oX6SERJXnL0zbNNNhOUWNp7NLI9498B5Q+ 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: List-Subscribe: List-Unsubscribe: On Fri, Apr 26, 2024 at 09:17:47AM +0200, David Hildenbrand wrote: > On 02.04.24 14:55, David Hildenbrand wrote: > > Let's consistently call the "fast-only" part of GUP "GUP-fast" and rename > > all relevant internal functions to start with "gup_fast", to make it > > clearer that this is not ordinary GUP. The current mixture of > > "lockless", "gup" and "gup_fast" is confusing. > > > > Further, avoid the term "huge" when talking about a "leaf" -- for > > example, we nowadays check pmd_leaf() because pmd_huge() is gone. For the > > "hugepd"/"hugepte" stuff, it's part of the name ("is_hugepd"), so that > > stays. > > > > What remains is the "external" interface: > > * get_user_pages_fast_only() > > * get_user_pages_fast() > > * pin_user_pages_fast() > > > > The high-level internal functions for GUP-fast (+slow fallback) are now: > > * internal_get_user_pages_fast() -> gup_fast_fallback() > > * lockless_pages_from_mm() -> gup_fast() > > > > The basic GUP-fast walker functions: > > * gup_pgd_range() -> gup_fast_pgd_range() > > * gup_p4d_range() -> gup_fast_p4d_range() > > * gup_pud_range() -> gup_fast_pud_range() > > * gup_pmd_range() -> gup_fast_pmd_range() > > * gup_pte_range() -> gup_fast_pte_range() > > * gup_huge_pgd() -> gup_fast_pgd_leaf() > > * gup_huge_pud() -> gup_fast_pud_leaf() > > * gup_huge_pmd() -> gup_fast_pmd_leaf() > > > > The weird hugepd stuff: > > * gup_huge_pd() -> gup_fast_hugepd() > > * gup_hugepte() -> gup_fast_hugepte() > > I just realized that we end up calling these from follow_hugepd() as well. > And something seems to be off, because gup_fast_hugepd() won't have the VMA > even in the slow-GUP case to pass it to gup_must_unshare(). > > So these are GUP-fast functions and the terminology seem correct. But the > usage from follow_hugepd() is questionable, > > commit a12083d721d703f985f4403d6b333cc449f838f6 > Author: Peter Xu > Date: Wed Mar 27 11:23:31 2024 -0400 > > mm/gup: handle hugepd for follow_page() > > > states "With previous refactors on fast-gup gup_huge_pd(), most of the code > can be leveraged", which doesn't look quite true just staring the the > gup_must_unshare() call where we don't pass the VMA. Also, > "unlikely(pte_val(pte) != pte_val(ptep_get(ptep)" doesn't make any sense for > slow GUP ... Yes it's not needed, just doesn't look worthwhile to put another helper on top just for this. I mentioned this in the commit message here: There's something not needed for follow page, for example, gup_hugepte() tries to detect pgtable entry change which will never happen with slow gup (which has the pgtable lock held), but that's not a problem to check. > > @Peter, any insights? However I think we should pass vma in for sure, I guess I overlooked that, and it didn't expose in my tests too as I probably missed ./cow. I'll prepare a separate patch on top of this series and the gup-fast rename patches (I saw this one just reached mm-stable), and I'll see whether I can test it too if I can find a Power system fast enough. I'll probably drop the "fast" in the hugepd function names too. Thanks, -- Peter Xu