Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2839896pxb; Sat, 25 Sep 2021 20:15:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6gG+Df1z5et3uftp1lGG1WbP3yXNJIKmzzXx/qAgFNqG0E4WSDLWycz/8XO9mCh2kuc7y X-Received: by 2002:a50:bf48:: with SMTP id g8mr14972384edk.10.1632626120785; Sat, 25 Sep 2021 20:15:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632626120; cv=none; d=google.com; s=arc-20160816; b=TUMa0WbN2YFR7GDmi7IAsm+F8MKl94JNKmoA9wCLiV3Ip6AcDMkmcYe05eTTLU30P/ 3dfCf2qQ6dCzhq83NInpXOE6S9S7FuQVG3pUTjvyhU8c1IOdyW549+lE4f9seN0BeLGa xE+KSna2c3OZJoyu10w+slRDcLgjMysBEJbpvSaRfeFGdo1trDYBwHBEDjW/YDtJE+wT Ui+twk7Sof2b8soeSh9LKN4iUq4P3e0Q5t1Irf9tTqSzZj92t/LaDy88rFwRyM3qbDek rxMjbWtTRGUEBP6aYlzvD2d6PRn8AmRGVUsO243ctmPPqHKTd4B2/K7Nak0cYWgjQ7Bu vN7w== 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=WwIZ0BhBYA1F8Xahxd7anDpTfWZsBUHuFr6CADROb6c=; b=tTdg+5/xzu9zRQi6EZXuxZYI23Es5/mi1JIZtepfKX2ocxJ3KRxNABnyB5HNLdilp9 l5xtK2B5bUz8CIMaCOpuOZGnHtdDzN14ukHkm3li4YMuhkXaJboiIX62rLbwesf7G+mO RFPcefw0dDIP1vNU9mQ2yA01VGpzvLcKWFbL3cXf1gOtXcNr/F9CWdaARlyAX5MSKpbh dWxOvpqOkC2pUIGsVeU1XxSJFp2NXOJqi2RKu+ZGX2foi/hP/WT2MH1LIS8TeKYDnh/H HHjTv3Ly7lnaBxJJ2ddmmgcHBnz0jKfObPpJJbTOAiFW9hihPyq3sgOr6hkcJIB54PkN 7kEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=il8nnVKN; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 v19si14513820edd.583.2021.09.25.20.14.49; Sat, 25 Sep 2021 20:15:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=il8nnVKN; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230369AbhIZDMs (ORCPT + 99 others); Sat, 25 Sep 2021 23:12:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230338AbhIZDMs (ORCPT ); Sat, 25 Sep 2021 23:12:48 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94B67C061570; Sat, 25 Sep 2021 20:11:12 -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=WwIZ0BhBYA1F8Xahxd7anDpTfWZsBUHuFr6CADROb6c=; b=il8nnVKNIf4P7d1b/wjKSIYSsb tKx4hIRiHaRAIWdEBd4+ppylMZXu8zj+sunMAUv+TAookWSNqbjWCTqQ6xZCbzO9nz8LVRtU5eRkd 2qqAe4aZyxP/jMB3vR2gELmqcn/uTa+TTcC9bJxCMyc1jDp4WCD0j5nA2HjcbT5ylZIDLRgBEx6hW wMLm/jdYvre6N0SpLJSED3l2DEVtfQ6kBBvhtgafZactWNTZLdgPPwiyhujYSm5XSi7gR+NN9zIgD gwTymYQIr2WuO3xqn+Mr8tukgD1eRuloL2tYfe754ETp6XoRMgmEDc1lF2Cbj+Eq11zBbRdlOskjB zkACra/Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUKYt-008bG5-I5; Sun, 26 Sep 2021 03:10:46 +0000 Date: Sun, 26 Sep 2021 04:10:43 +0100 From: Matthew Wilcox To: Dave Chinner Cc: David Howells , hch@lst.de, trond.myklebust@primarydata.com, Theodore Ts'o , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, Trond Myklebust , "Darrick J. Wong" , Jeff Layton , Andreas Dilger , Anna Schumaker , linux-mm@kvack.org, Bob Liu , "Darrick J. Wong" , Josef Bacik , Seth Jennings , Jens Axboe , linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-cifs@vger.kernel.org, Chris Mason , David Sterba , Minchan Kim , Steve French , NeilBrown , Dan Magenheimer , linux-nfs@vger.kernel.org, Ilya Dryomov , linux-btrfs@vger.kernel.org, viro@zeniv.linux.org.uk, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [RFC][PATCH v3 0/9] mm: Use DIO for swap and fix NFS swapfiles Message-ID: References: <163250387273.2330363.13240781819520072222.stgit@warthog.procyon.org.uk> <20210925234243.GA1756565@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210925234243.GA1756565@dread.disaster.area> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Sun, Sep 26, 2021 at 09:42:43AM +1000, Dave Chinner wrote: > Ok, so if the filesystem is doing block mapping in the IO path now, > why does the swap file still need to map the file into a private > block mapping now? i.e all the work that iomap_swapfile_activate() > does for filesystems like XFS and ext4 - it's this completely > redundant now that we are doing block mapping during swap file IO > via iomap_dio_rw()? Hi Dave, Thanks for bringing up all these points. I think they all deserve to go into the documentation as "things to consider" for people implementing ->swap_rw for their filesystem. Something I don't think David perhaps made sufficiently clear is that regular DIO from userspace gets handled by ->read_iter and ->write_iter. This ->swap_rw op is used exclusive for, as the name suggests, swap DIO. So filesystems don't have to handle swap DIO and regular DIO the same way, and can split the allocation work between ->swap_activate and the iomap callback as they see fit (as long as they can guarantee the lack of deadlocks under memory pressure). There are several advantages to using the DIO infrastructure for swap: - unify block & net swap paths - allow filesystems to _see_ swap IOs instead of being bypassed - get rid of the swap extent rbtree - allow writing compound pages to swap files instead of splitting them - allow ->readpage to be synchronous for better error reporting - remove page_file_mapping() and page_file_offset() I suspect there are several problems with this patchset, but I'm not likely to have a chance to read it closely for a few days. If you have time to give the XFS parts a good look, that would be fantastic.