Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp933105pxv; Thu, 15 Jul 2021 20:22:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8xEeBexbsDvnzQBBSYTIriNKuUV+x5s9THio+oO57qUZEjbU9OISupA9Hpt7aqu+otDSF X-Received: by 2002:a17:906:e1a:: with SMTP id l26mr9279145eji.129.1626405769613; Thu, 15 Jul 2021 20:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626405769; cv=none; d=google.com; s=arc-20160816; b=yfVoQ4q+HhY/J2cRN2MS8WN1pTPjbGM7eyHvbOHoTTguo5TUhmYXyxHYCIt1oD2+zz 9FkxvlNMNC9mTqQgjEhrpCis5QEA0/g+FzAHmXDtl2NEXFz9sTiOWEQ5NuAu7iZiZ+Hh plZusfvvaQT9juC3aD3RSqwzZInrQ6gZ0o/GEwwp+nDNG9R72zYixRphQWLeFq4HLvST UF6PZeJBcOPAjthV5kYlbOg5xHP7LjIy87CKJamZ8ZVtFgnWKRuRbDtgyC3kbTRC8nIq nqg+bUE3B+VgDQ5HwuhgXBJRNmWlv65lQaVFhQXtixO1VTWitEXXEUBU/WjLq4Ttrke0 WVtw== 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=YJuHEwapSltASFpILWUNzMl5SPEKG8/2ANXYoq2HkBU=; b=Ebn/4B7GdfQmOdFt6c+s8lzrtTIbN528YrHrwQ9NaN7Ayx24ef/VSGevbS9HFdeycZ 5/b5OstR3MAJfNfAiBjyRdCdfkjsscAXjzhT7f8XbbQNHToj5ck6xAHqugZN3ONZo/1U 1GpQkek5W+kiWg2YodE0cD6QzwjnvySzpGh+/KsmWSQmSSYplxYb93sybdSOe5Hdp9lg 0iqWgsADXVwMDMkpVryBely3d2NfYtC+zW14xAAF1iZ3JGzO38ZGty102lsKPdHfVaJ0 vZAlPBXCPx4d5Pp6hC1O1xgJ+8MFlK1KhGmT8UAUSYsDoJyw6jjR47xNMQg7inTXOz6o yRqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=h36gNtuV; 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 h15si8932338ejj.98.2021.07.15.20.22.26; Thu, 15 Jul 2021 20:22:49 -0700 (PDT) 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=h36gNtuV; 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 S233726AbhGPDVz (ORCPT + 99 others); Thu, 15 Jul 2021 23:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231230AbhGPDVw (ORCPT ); Thu, 15 Jul 2021 23:21:52 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A27AC06175F; Thu, 15 Jul 2021 20:18:58 -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=YJuHEwapSltASFpILWUNzMl5SPEKG8/2ANXYoq2HkBU=; b=h36gNtuVFuvS9UeGvV/j+hrId+ zvo+adnj2okPAYN6dPtpp21ecuG4iZfLScgRZhAj5Iq3KIzBiVvrn7erZeSxMjlryTjnDDxslDzVx fZoyInAnyLJmI89qOVsdRd7jgCmjBac1c9ttT0NHDae591fNilMxvrvhKT0EQk6k0sENCFevC9vR1 OACfEf2gjmL/vyRqD5rRIKSZbuwSpmiyO85uAXiMPujT84sJss1sFbH4LS25xUQXsuQGtsWCWbamA zNrOkREMhCXcv7FD08OiK3nHLJc6/LGFEmX5bGwwOi46dv83+po2AwNvTRySdYNxVTjOybtPlMmZ+ Bm+gJm+w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m4EMl-0046Aa-2a; Fri, 16 Jul 2021 03:18:32 +0000 Date: Fri, 16 Jul 2021 04:18:19 +0100 From: Matthew Wilcox To: "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v14 101/138] iomap: Convert iomap_page_mkwrite to use a folio Message-ID: References: <20210715033704.692967-1-willy@infradead.org> <20210715033704.692967-102-willy@infradead.org> <20210715214106.GL22357@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210715214106.GL22357@magnolia> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 15, 2021 at 02:41:06PM -0700, Darrick J. Wong wrote: > > @@ -975,33 +975,33 @@ iomap_page_mkwrite_actor(struct inode *inode, loff_t pos, loff_t length, > > > > vm_fault_t iomap_page_mkwrite(struct vm_fault *vmf, const struct iomap_ops *ops) > > { > > - struct page *page = vmf->page; > > + struct folio *folio = page_folio(vmf->page); > > If before the page fault the folio was a compound 2M page, will the > memory manager will have split it into 4k pages before passing it to us? > > That's a roundabout way of asking if we should expect folio_mkwrite at > some point. ;) Faults are tricky. For ->fault, we need to know the precise page which the fault occurred on (this detail is handled for you by filemap_fault()). For mkwrite(), the page will not be split, so it's going to be a matter of just marking the entire compound page as dirty (in the head page) and making sure the filesystem is able to write back the entire folio. Yes, there's going to be some write amplification here. I believe this will turn out to be a worthwhile tradeoff. If I'm wrong, we can implement some kind of split-on-fault.