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 67ADAC61D85 for ; Thu, 23 Nov 2023 19:11:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D5AD96B0678; Thu, 23 Nov 2023 14:11:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D0A596B067A; Thu, 23 Nov 2023 14:11:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD1EB6B070C; Thu, 23 Nov 2023 14:11:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id ACEA76B0678 for ; Thu, 23 Nov 2023 14:11:31 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 68C55807BB for ; Thu, 23 Nov 2023 19:11:31 +0000 (UTC) X-FDA: 81490162782.17.D66FDCE Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf10.hostedemail.com (Postfix) with ESMTP id 51882C0012 for ; Thu, 23 Nov 2023 19:11:29 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700766689; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QKQYN0qAPT5fBUua0ygKZQPV9mB45qnOX1ijzE18NlY=; b=LyYzxVlALTPiT+7l2a+fc8DQwPj9hYbZZiJBHMXaDvVyNKBg1YUUKNGb74snKkpDriqKCx fk1qpHyNFNZdSdCoxJ8pBCHMR7df49RJ/H1K2a69S7RWiavxMyYa4y5mTngNOT3blUjFDy U+Ch2vw8yAW5ru3Py36OpQ1+SA4k01g= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700766689; a=rsa-sha256; cv=none; b=nBLUrM4LgZpI9eqLFcd557bFvgQRw0g/7q4bcz/zEJQdMHmpCNNvOnvkZi4TAUiNJKXlKX dRb+sCwgYBog8ORebu/X9fTYuqurHtXtALhG0HaeAHdAvjD8wUPw8F1SPbDguWZgoSMup9 0AjKzVB0jmaQciS5KKCJhMKsQ+z1PFk= 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-Rspamd-Queue-Id: 51882C0012 X-Rspam-User: X-Stat-Signature: jqhn6p13bmhoekfxwqeduxorbip37p44 X-Rspamd-Server: rspam01 X-HE-Tag: 1700766689-257871 X-HE-Meta: U2FsdGVkX18+n1XO11jF0rhTj/UohbOpjL6fyGgoYYMvAY/+MJeiCdMreI4BiCpdHj79kQ1J49ckMzmXmQj5itCZfJ5HmHCExvzqWS9cpHJESNtvOzfLqxJHIW7uraAuff5lKexIhBWgcgM4ZgTuMSLwYqEm1f9iniacCJWbmp//QhEwhA9/LtKOel3dAE3hM4gHSyOFm3v4f0gAbRP99kiBcRwJbMNqjGZgJszl1nUotXXV3xhsY8uhVH7dBUB8ujhq6eDIiWzaLxbqh96QJRs+EhsiNjJgGNDdp00HvIZMLShLpnJPfef0xEQ/0+zUweXpyBq6eBMFC3HWOG2LZtzdcbEl16ySkxPeGCd/g1mwcGYKQx0X26N44TdMfTwg/vTuaXxF15xNfIoJquV33pSRDGVbuM5gFQ7UJNt4pp+dXSIkLpcyIjtX+LK6NFWG7TXwD5rjfmvscPeRkYdHlfmgjFdkxP4GfXZy0tJsjCWqhNNuXWkKOO9kubUyIFCqyzwDYSiXu2ZVd+9jvZUfUVLTnZFEAKF32hnV7S3Cj9HO6qCF0E2MnKjkEmtowwkfoATZXOde90MyDTS0Q/jpRiPdxcFuWimUTjjNMcLKMtA9Q5UMBF5vIeUlOdLecEItv9yzdCPhWRkfnftufnUambpr/UgHOV360XKEQ3FvZr1MGgGyOTB1UjMsV3K02hLG5D4ptWN2MXUxajvdnLINn4w+jVt5yPDWfkXjXHaamyVz0uw6G+ZtWp/WETQHz1X1b+bTdd4K9y96InZLhD0eEKcMkSl5JStp3B0KnJIdsAaF9AEKCOhpmAhOpvYViySNy/hNS0eqhcdtld2I/c2YBfqfM0jObgi4eluWUcOfbGy1CdQkRZKYEhJChDMZ1N5Mh5MMgDeBggD/36EDEpziydUpNlGDu3iiwVQ2EM1er4oKo8vO1OUmzp3ZSO+xFzj03wRSZLLAz/Yl/OEQYvL U9Dundm7 M/BdV8pgpml+b7n6w+EaXr+nUbtJtKXjwTL2HKfDqNI8sfUewcmx3b7u9gubf0AOuOYRITzRR3EYLnA9kiEXKqY+7G1QaXYfnK8Wcu0EvtTVcIVUwxjANDoQkalqCLsNtQ14gmTm/Xu6kLwJymOmPq3CzesgUNZ53yEy8lOE5Foha3H/EKpJ/b5KKcwUS6X1tOAkfEpx6woHyMtntpUL6tlpVRqlGNYa/Z++aRju+aL58aJsbwrUmIW2ePtivIU6CCrGjRU4B9KLAiQWN20Z8xqSoWzDjWf7hHVCyUixolzOc++3Bj4YOBWQgJm/1S9WDPG0n 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 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, >