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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3058EE49A3 for ; Tue, 22 Aug 2023 15:24:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234617AbjHVPYQ (ORCPT ); Tue, 22 Aug 2023 11:24:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233532AbjHVPYP (ORCPT ); Tue, 22 Aug 2023 11:24:15 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 886F8CD1; Tue, 22 Aug 2023 08:24:13 -0700 (PDT) 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=VmtAtCcHRfR32PnwuVa9rLL2uGT/TuCRRqTlgyU2vBA=; b=M/0/D5T3AyM8nE1eiuk7zbB7kQ BJrm5LWDM76wZcpRlUeUCl5ar6M7LqHhjbON3vQMbyweMSxSFmB5OgRYyMzWmBnVFnL7cRXEIRI2k +n31COizrjThN1j9n443LMvLNQLHJUILNsqHPwBiXGmJhYz9WMrndPhu2WLjej9VojPyBazd4IAPZ 3i2zAOqaXLdAgTzgiS0tE8XMBFu5jps70cx4hrqdbETII5iv5evh1/hveF6E8VBdkOPciXOwlGJeA jaQxBw/pZbJCFwqisyevMFsMIrN1oQcerGvlcS3NpR38lQxo3TF10oJ//HmzjywWxjVjY6ifAcgqY VYfbDqvg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qYTDW-00H50z-QD; Tue, 22 Aug 2023 15:22:50 +0000 Date: Tue, 22 Aug 2023 16:22:50 +0100 From: Matthew Wilcox To: Jann Horn Cc: Hugh Dickins , Andrew Morton , Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Yang Shi , Mel Gorman , Peter Xu , Peter Zijlstra , Will Deacon , Yu Zhao , Alistair Popple , Ralph Campbell , Ira Weiny , Steven Price , SeongJae Park , Lorenzo Stoakes , Huang Ying , Naoya Horiguchi , Christophe Leroy , Zack Rusin , Jason Gunthorpe , Axel Rasmussen , Anshuman Khandual , Pasha Tatashin , Miaohe Lin , Minchan Kim , Christoph Hellwig , Song Liu , Thomas Hellstrom , Russell King , "David S. Miller" , Michael Ellerman , "Aneesh Kumar K.V" , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda , Alexander Gordeev , Gerald Schaefer , Vasily Gorbik , Vishal Moola , Vlastimil Babka , Zi Yan , Zach O'Keefe , Linux ARM , sparclinux@vger.kernel.org, linuxppc-dev , linux-s390 , kernel list , Linux-MM Subject: Re: [PATCH mm-unstable] mm/khugepaged: fix collapse_pte_mapped_thp() versus uffd Message-ID: References: <4d31abf5-56c0-9f3d-d12f-c9317936691@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-s390@vger.kernel.org On Tue, Aug 22, 2023 at 04:39:43PM +0200, Jann Horn wrote: > > Perhaps something else will want that same behaviour in future (it's > > tempting, but difficult to guarantee correctness); for now, it is just > > userfaultfd (but by saying "_armed" rather than "_missing", I'm half- > > expecting uffd to add more such exceptional modes in future). > > Hm, yeah, sounds okay. (I guess we'd also run into this if we ever > wanted to make it possible to reliably install PTE markers with > madvise() or something like that, which might be nice for allowing > userspace to create guard pages without unnecessary extra VMAs...) I don't know what a userspace API for this would look like, but I have a dream of creating guard VMAs which only live in the maple tree and don't require the allocation of a struct VMA. Use some magic reserved pointer value like XA_ZERO_ENTRY to represent them ... seems more robust than putting a PTE marker in the page tables?