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 4CE1BC433F5 for ; Sun, 19 Dec 2021 11:49:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 647C36B0071; Sun, 19 Dec 2021 06:49:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F7076B0073; Sun, 19 Dec 2021 06:49:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E63B6B0074; Sun, 19 Dec 2021 06:49:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0157.hostedemail.com [216.40.44.157]) by kanga.kvack.org (Postfix) with ESMTP id 3F3126B0071 for ; Sun, 19 Dec 2021 06:49:31 -0500 (EST) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id EF8A5181AC9C6 for ; Sun, 19 Dec 2021 11:49:14 +0000 (UTC) X-FDA: 78934373028.31.FAE63D0 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf24.hostedemail.com (Postfix) with ESMTP id BC07B180037 for ; Sun, 19 Dec 2021 11:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=+xLGuwkGLHj6F7qVwSYYRQuCk2pKTFB8i/Od87i7OI4=; b=gRcXsixJbfh9FauWZ461228HXj eiOUlnI/kN8lAHWcRfPWIUUcbKLX9gTpfvnLUaEH547R3d7CTdwspdKQIy578WckdditrK3ydgd7E wiCwBRF9jdFOnsULc3pUf6lu7RDGR4hyve5eS5DrjWqQ7gqRJk7diGoIjV69tHlPqEJClfZt0M9cX 5zyzzcUCqzi9qmvXMcwBIJv/6fqkvbXqPdRPE7cvff0aILtksT5/gtjBegOXuz1BYlUEbFCQDPBWV m03FUkC2RC6un46QqBCrJhN4SIxSCcIXD9QIs5i5qkPNUxKMBH1E+y1Zv7iAaBkPfS4BT82RAv9Qq ilFAdGrA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1myuOT-000hbL-AB; Sun, 19 Dec 2021 11:30:21 +0000 Date: Sun, 19 Dec 2021 11:30:21 +0000 From: Matthew Wilcox To: John Hubbard Cc: Nadav Amit , Linus Torvalds , David Hildenbrand , Jason Gunthorpe , Linux Kernel Mailing List , Andrew Morton , Hugh Dickins , David Rientjes , Shakeel Butt , Mike Kravetz , Mike Rapoport , Yang Shi , "Kirill A . Shutemov" , Vlastimil Babka , Jann Horn , Michal Hocko , Rik van Riel , Roman Gushchin , Andrea Arcangeli , Peter Xu , Donald Dutile , Christoph Hellwig , Oleg Nesterov , Jan Kara , Linux-MM , "open list:KERNEL SELFTEST FRAMEWORK" , "open list:DOCUMENTATION" Subject: Re: [PATCH v1 06/11] mm: support GUP-triggered unsharing via FAULT_FLAG_UNSHARE (!hugetlb) Message-ID: References: <20211218030509.GA1432915@nvidia.com> <5C0A673F-8326-4484-B976-DA844298DB29@vmware.com> <20211218184233.GB1432915@nvidia.com> <5CA1D89F-9DDB-4F91-8929-FE29BB79A653@vmware.com> <4D97206A-3B32-4818-9980-8F24BC57E289@vmware.com> <5A7D771C-FF95-465E-95F6-CD249FE28381@vmware.com> <341cf567-468e-b5cf-6813-b26c49e851b5@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <341cf567-468e-b5cf-6813-b26c49e851b5@nvidia.com> Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=gRcXsixJ; dmarc=none; spf=none (imf24.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: BC07B180037 X-Stat-Signature: zrepu7r8nzjpzm3zn5su34jpi1oye3xy X-HE-Tag: 1639914550-202920 Content-Transfer-Encoding: quoted-printable 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 Sun, Dec 19, 2021 at 12:01:59AM -0800, John Hubbard wrote: > On 12/18/21 22:02, Nadav Amit wrote: > > I found my old messy code for the software-PTE thing. > >=20 > > I see that eventually I decided to hold a pointer to the =E2=80=9Cext= ra PTEs=E2=80=9D > > of each page in the PMD-page-struct. [ I also implemented the 2-adjac= ent > > pages approach but this code is long gone. ] > > a) The PMD-page-struct approach won't help as much, because (assuming > that we're using it in an attempt to get a true, perfect pin count), yo= u > are combining the pin counts of a PMD's worth of pages. OTOH...maybe > that actually *is* OK, assuming you don't overflow--except that you can > only answer the "is it dma-pinned?" question at a PMD level. That's a > contradiction of your stated desire above to have very granular control= . >=20 > Also, because of not having bit 0 available in page._pt_pad_1, I think > the count would have to be implemented as adding and subtracting 2, > instead of 1 (in order to keep the value even), further reducing the > counter range. I think you misunderstood Nadav's approach. He's talking about making an extra side-allocation per PMD if you're using uffd, and storing extra information in it. I think it's a worthwile approach.