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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 DE618C4320A for ; Fri, 13 Aug 2021 06:54:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4702D610FC for ; Fri, 13 Aug 2021 06:54:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4702D610FC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id A8AD08D0003; Fri, 13 Aug 2021 02:54:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A3B5C6B0071; Fri, 13 Aug 2021 02:54:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9511A8D0003; Fri, 13 Aug 2021 02:54:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0211.hostedemail.com [216.40.44.211]) by kanga.kvack.org (Postfix) with ESMTP id 7AA946B006C for ; Fri, 13 Aug 2021 02:54:31 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 218A58249980 for ; Fri, 13 Aug 2021 06:54:31 +0000 (UTC) X-FDA: 78469143942.40.95FC4FE Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf04.hostedemail.com (Postfix) with ESMTP id 73E87500A644 for ; Fri, 13 Aug 2021 06:54:30 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 28DA967373; Fri, 13 Aug 2021 08:54:27 +0200 (CEST) Date: Fri, 13 Aug 2021 08:54:26 +0200 From: Christoph Hellwig To: "Darrick J. Wong" Cc: Christoph Hellwig , Matthew Wilcox , 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: <20210813065426.GA26243@lst.de> 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> User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 73E87500A644 Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=none; spf=none (imf04.hostedemail.com: domain of hch@lst.de has no SPF policy when checking 213.95.11.211) smtp.mailfrom=hch@lst.de X-Rspamd-Server: rspam04 X-Stat-Signature: 8fihxktthkftggz9jwjnkmpn5g7n4rf6 X-HE-Tag: 1628837670-888324 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? Yes. While direct I/O code could do allocation at swap I/O time that probably is not a good idea due to the memory requirements.