Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp554015rdh; Thu, 23 Nov 2023 11:11:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtrnnoJtMSuYT/7VkaJ0U8+FiXj9tsBirnQtvcRamubr1zyd8iGBuJCAvW6WZqJ0leT61s X-Received: by 2002:a17:902:efc2:b0:1ca:e491:f525 with SMTP id ja2-20020a170902efc200b001cae491f525mr434084plb.31.1700766710320; Thu, 23 Nov 2023 11:11:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700766710; cv=none; d=google.com; s=arc-20160816; b=gKMuiw6LROtQvLtLywfdXx5HbmcNWgvx2E8hnZyD+HiylCw9K+yxFJQV4ge6zERiM4 abCRHHyWZHFGunSiis9naPhCpR7lqimpxtdPeUduSoLpf+xDEHemaaJZxOaISuagcyof oJMlMoBOl6hgF5LsjQhhzYgLIzFgeFwP4i9QTfopzR6tp3u5juvlWUFuo+MVJw4fqT43 6bkO8raJtCevKco4WcXuaxO4xzv/pBCfUhRcRL8bJPKSxilumBUW6xvDSwwse7aHyFwb 5f9ULSDifEvItVZxbvBIFTdtiyReyQo95p/mihLrezTD3z6iGN32MSL90MIJgzagV1Ov CldQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=QKQYN0qAPT5fBUua0ygKZQPV9mB45qnOX1ijzE18NlY=; fh=DrBEOAHoWlGN+7se7FoY1hPoyu+21DSWDcFZrm7VFxg=; b=lYFWZU8pNZ9LQq5YQ3OVekONK8tw6x78qq9TeKYG7n/T+CC/Q9B+SN1FzQAIaTzHL3 6Hub9Jmxkn95pUj2tRUN47vfymZYoELFJWKll3bPf1KKCDjJkVtTuibXHYbDKcO+VmC4 ROoOu021Wh5cgIK2rS4hP+I4/FHxBgnuyjnNgXK3L/jIpB6+oEveVk8JYgd9Cl4Gs/qM N2aWJ2o2kCvC0VbZt3wcmaP3/Aw+cjvig7BbxV1g9mJo9cjFzBcvvj7Dx+jvWn4rfCK+ vRcK/nbootNsKdgi4lpAdNn6+weHC1SqECT5H7UEzrRwXzc2ADN+UmPt2alj29UiaN7G gBgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id jj14-20020a170903048e00b001cf688a2854si1653179plb.371.2023.11.23.11.11.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 11:11:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 69E14827A708; Thu, 23 Nov 2023 11:11:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229805AbjKWTLY (ORCPT + 99 others); Thu, 23 Nov 2023 14:11:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjKWTLW (ORCPT ); Thu, 23 Nov 2023 14:11:22 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A6FA89E for ; Thu, 23 Nov 2023 11:11:28 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9C64A1042; Thu, 23 Nov 2023 11:12:14 -0800 (PST) Received: from [10.57.70.238] (unknown [10.57.70.238]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 746AA3F7A6; Thu, 23 Nov 2023 11:11:25 -0800 (PST) Message-ID: Date: Thu, 23 Nov 2023 19:11:19 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC 06/12] mm/gup: Drop folio_fast_pin_allowed() in hugepd processing Content-Language: en-GB To: Peter Xu , Matthew Wilcox Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrea Arcangeli , James Houghton , Lorenzo Stoakes , David Hildenbrand , Vlastimil Babka , John Hubbard , Yang Shi , Rik van Riel , Hugh Dickins , Jason Gunthorpe , Axel Rasmussen , "Kirill A . Shutemov" , Andrew Morton , linuxppc-dev@lists.ozlabs.org, Mike Rapoport , Mike Kravetz References: <20231116012908.392077-1-peterx@redhat.com> <20231116012908.392077-7-peterx@redhat.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 23 Nov 2023 11:11:47 -0800 (PST) On 23/11/2023 17:22, Peter Xu wrote: > On Thu, Nov 23, 2023 at 03:47:49PM +0000, Matthew Wilcox wrote: >> It looks like ARM (in the person of Ryan) are going to add support for >> something equivalent to hugepd. > > If it's about arm's cont_pte, then it looks ideal because this series > didn't yet touch cont_pte, assuming it'll just work. From that aspect, his > work may help mine, and no immediately collapsing either. Hi, I'm not sure I've 100% understood the crossover between this series and my work to support arm64's contpte mappings generally for anonymous and file-backed memory. My approach is to transparently use contpte mappings when core-mm request pte mappings that meet the requirements; and its all based around intercepting the normal (non-hugetlb) helpers (e.g. set_ptes(), ptep_get() and friends). There is no semantic change to the core-mm. See [1]. It relies on 1) the page cache using large folios and 2) my "small-sized THP" series which starts using arbitrary sized large folios for anonymous memory [2]. If I've understood this conversation correctly there is an object called hugepd, which today is only supported by powerpc, but which could allow the core-mm to control the mapping granularity? I can see some value in exposing that control to core-mm in the (very) long term. [1] https://lore.kernel.org/all/20231115163018.1303287-1-ryan.roberts@arm.com/ [2] https://lore.kernel.org/linux-mm/20231115132734.931023-1-ryan.roberts@arm.com/ Thanks, Ryan > > There can be a slight performance difference which I need to measure for > arm's cont_pte already for hugetlb, but I didn't worry much on that; > quotting my commit message in the last patch: > > There may be a slight difference of how the loops run when processing > GUP over a large hugetlb range on either ARM64 (e.g. CONT_PMD) or RISCV > (mostly its Svnapot extension on 64K huge pages): each loop of > __get_user_pages() will resolve one pgtable entry with the patch > applied, rather than relying on the size of hugetlb hstate, the latter > may cover multiple entries in one loop. > > However, the performance difference should hopefully not be a major > concern, considering that GUP just yet got 57edfcfd3419 ("mm/gup: > accelerate thp gup even for "pages != NULL""), and that's not part of a > performance analysis but a side dish. If the performance will be a > concern, we can consider handle CONT_PTE in follow_page(), for example. > > So IMHO it can be slightly different comparing to e.g. page fault, because > each fault is still pretty slow as a whole if one fault for each small pte > (of a large folio / cont_pte), while the loop in GUP is still relatively > tight and short, comparing to a fault. I'd boldly guess more low hanging > fruits out there for large folio outside GUP areas. > > In all cases, it'll be interesting to know if Ryan has worked on cont_pte > support for gup on large folios, and whether there's any performance number > to share. It's definitely good news to me because it means Ryan's work can > also then benefit hugetlb if this series will be merged, I just don't know > how much difference there will be. > > Thanks, >