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 X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AC6CC433DB for ; Tue, 29 Dec 2020 15:19:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AF293221F8 for ; Tue, 29 Dec 2020 15:19:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF293221F8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A53208D002F; Tue, 29 Dec 2020 10:19:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A039B8D002C; Tue, 29 Dec 2020 10:19:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 919D28D002F; Tue, 29 Dec 2020 10:19:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id 7C10A8D002C for ; Tue, 29 Dec 2020 10:19:29 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 30977362B for ; Tue, 29 Dec 2020 15:19:29 +0000 (UTC) X-FDA: 77646678858.22.cart98_37017432749d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 0C55418038E60 for ; Tue, 29 Dec 2020 15:19:29 +0000 (UTC) X-HE-Tag: cart98_37017432749d X-Filterd-Recvd-Size: 4119 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Tue, 29 Dec 2020 15:19:26 +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=xLMIthYL2Moj7S22JZC3kYzACmfCDhYMvd4FNRf+Y5g=; b=u9jp5uidl9OFE7aCkObe9hp5pE +3t85eqnumPsw8Itiig813l4H8FbMDr8AB3FsQ3aGflZ4y1LWngwZTpC18ULCj7WjiL4oFyWzSnV/ T83wdFX0xpUfzoKThAEewAT6fWdIx4uABtIZ2kE1npaPbtNtCMRaG9nEDKRm+ocFuZDtmwmRkJCTu 5VssaG1acx+twykk7iaTIip2PdVqbhd67tl+wZIUvZl4yD6TQOMmQ/emoSOf+KXuAAZHalpZ/Puws MOAt8LUcun9ENkXyMeviWVznuZZx6+ruszTg0v2X0TaKUKLE6Mznmi/nK63Zu2490TWXR3beqi0fN Wz7IMSUQ==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1kuGm6-0004xb-NO; Tue, 29 Dec 2020 15:19:03 +0000 Date: Tue, 29 Dec 2020 15:19:02 +0000 From: Matthew Wilcox To: "Kirill A. Shutemov" Cc: Linus Torvalds , Hugh Dickins , "Kirill A. Shutemov" , Will Deacon , Linux Kernel Mailing List , Linux-MM , Linux ARM , Catalin Marinas , Jan Kara , Minchan Kim , Andrew Morton , Vinayak Menon , Android Kernel Team Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting Message-ID: <20201229151902.GC28221@casper.infradead.org> References: <20201227234853.5mjyxcybucts3kbq@box> <20201228125352.phnj2x2ci3kwfld5@box> <20201229132819.najtavneutnf7ajp@box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201229132819.najtavneutnf7ajp@box> 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 Tue, Dec 29, 2020 at 04:28:19PM +0300, Kirill A. Shutemov wrote: > > At that point, there would no longer be any need to update the > > address/pte fields in the vmf struct, and in fact I think it could be > > made a "const" pointer in this cal chain. > > Unfortunately, we would still need to NULLify vmf->prealloc_pte once it's > consumed. It kills idea with const. We could abstract out a refcount for pgtable_t (usually it's a struct page, but sometimes it's a portion of a struct page, or sometimes it's multiple struct pages) and always put it instead of freeing it. There'd be some details to sort out, and I'm not sure it's worth it just to constify the vmf on this path, but something that might be worth it for a future case. > +++ b/fs/xfs/xfs_file.c > @@ -1319,17 +1319,19 @@ xfs_filemap_pfn_mkwrite( > return __xfs_filemap_fault(vmf, PE_SIZE_PTE, true); > } > > -static void > +static vm_fault_t > xfs_filemap_map_pages( Can we just ditch the ->map_pages callback and make the rule "if you've put uptodate pages in the page cache, they can be mapped without informing the filesystem"? > +++ b/include/linux/mm.h > @@ -534,8 +534,8 @@ struct vm_fault { > * is not NULL, otherwise pmd. > */ > pgtable_t prealloc_pte; /* Pre-allocated pte page table. > - * vm_ops->map_pages() calls > - * alloc_set_pte() from atomic context. > + * vm_ops->map_pages() sets up a page > + * table from from atomic context. Doubled word "from" here.