Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9870512pxu; Tue, 29 Dec 2020 07:20:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfdcLcs6mhFB2Vq1oiLEq0lQ0hufEDV1xB8OC25tyXfXM7XMrI5RPTmcyCGu7IczirAw/I X-Received: by 2002:a17:906:c82c:: with SMTP id dd12mr46629727ejb.66.1609255255850; Tue, 29 Dec 2020 07:20:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609255255; cv=none; d=google.com; s=arc-20160816; b=CHocOFB51mGO0vD6cR3W5qKTfHW/x+DV91aLow9//gz6Sw15n14eUYpxGZ4ivDH6hW pp3tZR0jfIoB4hEJemYWFMeRp01820nsPBBTH6t4KAFouwZYYQLWYutkgNsFf8Be+UZW Fy7tROir3ab7n/fgQF9alv8TcQf5hC+btH71tEDifGWp+zOQJYVdWzU4WfrcxElfyjL0 +p68E/UbKoddC7UEcSfKL6gCs4P0PTD+0jh9aKiTNfRv9efbecFPS2evBLJiYLIimw9Y T26Seh5U6zcIDyr56Z6w4xQteNVVlfAFOvWlDJC0BgkaaXOMcYmMf/G7nA6yklANzfPo mihQ== 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=xLMIthYL2Moj7S22JZC3kYzACmfCDhYMvd4FNRf+Y5g=; b=sAGQDGjYll5SG8luH9uxs5mWaXwJFM1KAtBZYBxt9yLi4wnC0MAcyejRcP9p6xjY/e UWg19R8srBtZvljy7kFdIGlmvVn5xk1QVFZ4zdoFpggWyiqo6NFnvhQq/CdBxPnl1h0z apYflzIBMO8Fkz/2DvxWNPBJ3rUdyue/Mmf4iqVaZo+CYfwuoT4Gmva6NOJcat+hxRKZ 4Jb4c/dmU4C27CQKEOwbAQ9CXzQI0DqfWx0qAniHDFUmYZJKIz5ndCunQjWK5lJPvuFd MEpAtd3d3qTo5olrgLyVFXbIdYbYZizNhz8T//wyrVF5+aguk7Lykw7lujNV0z2I+hnk JSCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=u9jp5uid; 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 qk27si20194015ejb.615.2020.12.29.07.20.32; Tue, 29 Dec 2020 07:20:55 -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=u9jp5uid; 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 S1726335AbgL2PUB (ORCPT + 99 others); Tue, 29 Dec 2020 10:20:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726218AbgL2PUB (ORCPT ); Tue, 29 Dec 2020 10:20:01 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CEA7C0613D6 for ; Tue, 29 Dec 2020 07:19:21 -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=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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.