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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 E1019C4338F for ; Thu, 12 Aug 2021 18:17:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 52B8A6104F for ; Thu, 12 Aug 2021 18:17:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 52B8A6104F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 9E5628D0002; Thu, 12 Aug 2021 14:17:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 995BC8D0001; Thu, 12 Aug 2021 14:17:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 884108D0002; Thu, 12 Aug 2021 14:17:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0065.hostedemail.com [216.40.44.65]) by kanga.kvack.org (Postfix) with ESMTP id 707E28D0001 for ; Thu, 12 Aug 2021 14:17:55 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2B251250D8 for ; Thu, 12 Aug 2021 18:17:55 +0000 (UTC) X-FDA: 78467237310.09.50ECC7D Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id 4B92DD02169E for ; Thu, 12 Aug 2021 18:17:53 +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=5naNxWdA4pUEsoIepEdmgfKgNVWUTTPIGgMAR+lKKNg=; b=kolKpAxAcGMvgpVrawdSEEL49q JwEPW4xC+wT3yIFiGaBpScKIBdDvYGsBhMai8C07lBouE306orWGVk7tHNTNrS5IlPcJW/jyBQYpR vt0+Sw7d+hFN47KpQseJFjCTVeHbNWzzaRWQ7P3COJ8NecKhaufewkI5+YlpXKygXjEObJP1CtdAc iw++yeMl9tZBc4YCOqbmw5/dWdoaPK1eiZ0eKPT4F0oGDa6BY1SYC3l3upvPzQJQnNmrVwf1O0lXe ydSBBvZ8YoElPo2PwBJHoVqOmXAvdk6+nNcUP1Z9U44fGfGMcT3wvu0ePNesSzjdktmfP52+2eE6p WrSq1Nlw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mEFDx-00EqyA-Vl; Thu, 12 Aug 2021 18:15:12 +0000 Date: Thu, 12 Aug 2021 19:14:37 +0100 From: Matthew Wilcox To: "Darrick J. Wong" Cc: Christoph Hellwig , David Howells , trond.myklebust@primarydata.com, darrick.wong@oracle.com, jlayton@kernel.org, sfrench@samba.org, torvalds@linux-foundation.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] mm: Make swap_readpage() for SWP_FS_OPS use ->direct_IO() not ->readpage() Message-ID: References: <20210812122104.GB18532@lst.de> <162876946134.3068428.15475611190876694695.stgit@warthog.procyon.org.uk> <162876947840.3068428.12591293664586646085.stgit@warthog.procyon.org.uk> <3085432.1628773025@warthog.procyon.org.uk> <20210812170233.GA4987@lst.de> <20210812174818.GK3601405@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210812174818.GK3601405@magnolia> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 4B92DD02169E X-Stat-Signature: 9c9r4ig7kpp3njom5zohjspurowncjnk Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=kolKpAxA; dmarc=none; spf=none (imf21.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1628792273-820611 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 Thu, Aug 12, 2021 at 10:48:18AM -0700, Darrick J. Wong wrote: > On Thu, Aug 12, 2021 at 07:02:33PM +0200, Christoph Hellwig wrote: > > On Thu, Aug 12, 2021 at 04:39:40PM +0100, Matthew Wilcox wrote: > > > I agree with David; we want something lower-level for swap to call into. > > > I'd suggest aops->swap_rw and an implementation might well look > > > something like: > > > > > > static ssize_t ext4_swap_rw(struct kiocb *iocb, struct iov_iter *iter) > > > { > > > return iomap_dio_rw(iocb, iter, &ext4_iomap_ops, NULL, 0); > > > } > > > > Yes, that might make sense and would also replace the awkward IOCB_SWAP > > flag for the write side. > > > > For file systems like ext4 and xfs that have an in-memory block mapping > > tree this would be way better than the current version and also support > > swap on say multi-device file systems properly. We'd just need to be > > careful to read the extent information in at extent_activate time, > > by doing xfs_iread_extents for XFS or the equivalents in other file > > systems. > > You'd still want to walk the extent map at activation time to reject > swapfiles with holes, shared extents, etc., right? Well ... this would actually allow the filesystem to break COWs and allocate new blocks for holes. Maybe you don't want to be doing that in a low-memory situation though ;-)