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 47A8AC433EF for ; Tue, 21 Dec 2021 03:30:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 71C016B007B; Mon, 20 Dec 2021 22:30:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6CA9F6B007D; Mon, 20 Dec 2021 22:30:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B97D6B0085; Mon, 20 Dec 2021 22:30:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 489AB6B007B for ; Mon, 20 Dec 2021 22:30:08 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id DDAAF8632A for ; Tue, 21 Dec 2021 03:30:07 +0000 (UTC) X-FDA: 78940372854.18.CA2E01A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf27.hostedemail.com (Postfix) with ESMTP id DB4A440009 for ; Tue, 21 Dec 2021 03:30:06 +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-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=4/ofnA93MB0dtNJDnD1hlkEoHaSdJsk2n9FUm5M/5P4=; b=jhNWENbQ7taimgHAwhZK+qk4O/ B0SrrJQsLG31HJBXTkSiLOYCGMEz38WndNA2sLzuqm4pnZ3fsnMtYQrXD7oa3gDYQV+2/bE6aCZqJ di+T2/wvtz6CotoytzvKvjuiwzsN2wh8iGnrexn0njrRIcc6iKLggwF18gEHWSvMXReRsD5zu19li +dQdybF1DCY1lGff19sXOK8dyQJB/TY7z7Eg2btAzScGrXGefOwOpR1ZXLe3FR1Dbcgzj4oGJV2hi WzK2YXlMvojWbc88kRurNY3+M43ngGye/j3WHnOH/C7RAGSnmB3HRuuUOBPAt/ICwMnX0e4Rvsy5U 7hpnFIAA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzVqJ-0028lH-RV; Tue, 21 Dec 2021 03:29:35 +0000 Date: Tue, 21 Dec 2021 03:29:35 +0000 From: Matthew Wilcox To: Jason Gunthorpe Cc: David Hildenbrand , Linus Torvalds , Nadav Amit , Linux Kernel Mailing List , Andrew Morton , Hugh Dickins , David Rientjes , Shakeel Butt , John Hubbard , 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: <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> <20211221010312.GC1432915@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211221010312.GC1432915@nvidia.com> X-Rspamd-Queue-Id: DB4A440009 X-Stat-Signature: hhkgdenw8a97zf5z1jd419nsssq66r7k Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=jhNWENbQ; spf=none (imf27.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam10 X-HE-Tag: 1640057406-185781 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 Mon, Dec 20, 2021 at 09:03:12PM -0400, Jason Gunthorpe wrote: > That just leave the THP splitting.. I suppose we get the PTL, then > compute the current value of the new bit based on refcount and diffuse > it to all tail pages, then update the PMD and release the PTL. Safe > against concurrent WP - don't need DoubleMap horrors because it isn't > a counter. One of the things I've been trying to figure out is how we do can_split_huge_page(). Maybe an rmap walk to figure out how many refcounts we would subtract if we did unmap it from everywhere it's currently mapped? (just to be clear, we call unmap_page() as the next thing, so I don't mind warming up the rbtree cachelines if it's mapped anywhere)