Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp1219212pxb; Sat, 9 Jan 2021 11:36:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwtMEjb3MBzndnpS2dIi4QbhC5kM1dmjhhuOH0LnCiu7QBpWhWsDSAh/QLKfbhqlvoa/KNL X-Received: by 2002:a05:6402:c95:: with SMTP id cm21mr9236207edb.294.1610220990333; Sat, 09 Jan 2021 11:36:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610220990; cv=none; d=google.com; s=arc-20160816; b=BCNjaJUBx0IA51KZyiwJtyUcM+9Mpb+0+mM5YYDz8tq8eH6VkQB7+z3a0HECVNIxcx jGCGE9gWDvbaTqrXQtZk5kHE6O+UR6XYkCxZaJ/dKtMJSqCxuKY8JjSt7YFh9iIKuy5k EwHEmWYbhEvepM8yrwF0+Ynd/0lLhWiU5eq3Du7euPStIemT64MvY1/ZHsfiIIj4fqu6 eghA/8fLvFuI6X4/nsaL6DhCjwDYyS6ISgYmQyXlFqqPFYcLDu+dTMLOmtICn/tM18Ut +FOVPw6sPl5qqdLjyTCoDtWi5ycOhMwHbEUx4DPcVeghHwiN0HRyTTcu2Vb0y12FqYx6 sSiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YK9bkc+ab6pT/dipKIxzM3oihklVajwXC+Iom3U0oGs=; b=Oc7PSO/D0Ctc2+i2ETnDg6cuyBjI3RE45mTq5JW97OXMus6NMmtgICBoMG4IjhCGi/ GSfkY0cKgj4be2SnoY8NAh9aHcedvHaXv1K3OOxrWFqf05xENZuUcKL013aC0eOLYSX7 eYZAJzC5fHth/jYXHct93aza7A0Vq9Wzgxp8HYqDoR7HS7Rcl8+5g2kZ7IQWfPth2w4M XES3lHies2dOTVHtiZvgQLvggGggBdCn6gkwc3Pa0ogSLzumxLA20E/NZnj/DKZrWoIF CbqMi1UO0baRpPxg16t9rHAZ6/u0jrAd5/dIv+hyOWalQ662X1eT7HMII72whheeuTtU 104w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uyerOwE4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bo6si5177195edb.434.2021.01.09.11.36.06; Sat, 09 Jan 2021 11:36:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uyerOwE4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726077AbhAITeW (ORCPT + 99 others); Sat, 9 Jan 2021 14:34:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbhAITeW (ORCPT ); Sat, 9 Jan 2021 14:34:22 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AEB5C06179F for ; Sat, 9 Jan 2021 11:33:42 -0800 (PST) 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=YK9bkc+ab6pT/dipKIxzM3oihklVajwXC+Iom3U0oGs=; b=uyerOwE4pe4/DqfSn97jIDMNkL fZIJky2MAsJVSJPzryAX9aGy5NNgNIihELIDVZ9L58TEekvFu2lUtTE2DO+9jRqbdcFVf1U5YlFf8 p0tRUMxkrjuVXsUMw/WE1W6XRHJ0oOrSlrUdrgTjewQTqvRsh0I0vAjG23bAQW8bUG/UyNunYnSAd AMoKhEmulCwKEaa3YmoLlxPKqoHRouUtrwmnTRnwgYOgYjqo0KQyr1BsS0drCTw1WiM2J7RXurioP X3Lmrh82C4NPGUrcX04fi90CPdd73I0MU29zzMNr0bh6xaXtIaJ069gvLfdwmNZB9RNbkSF21rITd mvtSiP4w==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1kyJyK-000qhE-Pd; Sat, 09 Jan 2021 19:32:42 +0000 Date: Sat, 9 Jan 2021 19:32:24 +0000 From: Matthew Wilcox To: Linus Torvalds Cc: Jason Gunthorpe , Andrea Arcangeli , Linux-MM , Linux Kernel Mailing List , Yu Zhao , Andy Lutomirski , Peter Xu , Pavel Emelyanov , Mike Kravetz , Mike Rapoport , Minchan Kim , Will Deacon , Peter Zijlstra , Hugh Dickins , "Kirill A. Shutemov" , Oleg Nesterov , Jann Horn , Kees Cook , John Hubbard , Leon Romanovsky , Jan Kara , Kirill Tkhai Subject: Re: [PATCH 0/2] page_count can't be used to decide when wp_page_copy Message-ID: <20210109193224.GB35215@casper.infradead.org> References: <20210107200402.31095-1-aarcange@redhat.com> <20210107202525.GD504133@ziepe.ca> 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-kernel@vger.kernel.org On Thu, Jan 07, 2021 at 01:05:19PM -0800, Linus Torvalds wrote: > Side note, and not really related to UFFD, but the mmap_sem in > general: I was at one point actually hoping that we could make the > mmap_sem a spinlock, or at least make the rule be that we never do any > IO under it. At which point a write lock hopefully really shouldn't be > such a huge deal. There's a (small) group of us working towards that. It has some prerequisites, but where we're hoping to go currently: - Replace the vma rbtree with a b-tree protected with a spinlock - Page faults walk the b-tree under RCU, like peterz/laurent's SPF patchset - If we need to do I/O, take a refcount on the VMA After that, we can gradually move things out from mmap_sem protection to just the vma tree spinlock, or whatever makes sense for them. In a very real way the mmap_sem is the MM layer's BKL.