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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F044C77B76 for ; Fri, 21 Apr 2023 02:25:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8783A900003; Thu, 20 Apr 2023 22:25:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 82864900002; Thu, 20 Apr 2023 22:25:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F0EE900003; Thu, 20 Apr 2023 22:25:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 5E3DC900002 for ; Thu, 20 Apr 2023 22:25:53 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 28A04AC8EB for ; Fri, 21 Apr 2023 02:25:53 +0000 (UTC) X-FDA: 80703807786.28.47ED397 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) by imf19.hostedemail.com (Postfix) with ESMTP id 398431A0015 for ; Fri, 21 Apr 2023 02:25:50 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=linux.org.uk header.s=zeniv-20220401 header.b=DeFQt246; spf=none (imf19.hostedemail.com: domain of viro@ftp.linux.org.uk has no SPF policy when checking 62.89.141.173) smtp.mailfrom=viro@ftp.linux.org.uk; dmarc=pass (policy=none) header.from=zeniv.linux.org.uk ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682043951; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Y1bbQJ7Lqx3xWtWj+CoARcsmEeD4ylMi8y4fbkOFWk8=; b=xOgoEnVeKm1wXowN7uRumuOPd1LC1BrGVqQH42cj4TKvn9NeSJ7gdotNe2I2uEzNwitzsC 590IjrDV6ymBTK3uLGpJIZxFPHmBodUDHb52jtbDKrNPZcIHDqIr1fZaYB/33YBZT+10Mg LEg17P7Or584QddyfYYo+cldvdKM4ZI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682043951; a=rsa-sha256; cv=none; b=TODVfsS4xfp9iy9ER/pT245HZC6DfHm2C5URiyDJIBjKYFzWpJTcr0FJcp3wWq+q6zhkpK ewuNZZq0Qrnz3OOQGD8LQJZ5yVcdVP2nRpn/oasERIQoBy+7+ROzBeMV50R1FDR0s8xfUd 4HCXx1qPBK7ocQKuVC+y3veT1b3AVE4= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=linux.org.uk header.s=zeniv-20220401 header.b=DeFQt246; spf=none (imf19.hostedemail.com: domain of viro@ftp.linux.org.uk has no SPF policy when checking 62.89.141.173) smtp.mailfrom=viro@ftp.linux.org.uk; dmarc=pass (policy=none) header.from=zeniv.linux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Y1bbQJ7Lqx3xWtWj+CoARcsmEeD4ylMi8y4fbkOFWk8=; b=DeFQt246yzDgknT7FPn5/XxNHH GbHy6KiFEA5Tpu+HGgzHFmYW6agusVPC+Emv9k35KuYlk5KaiTns4veWfFAMpD02EDxICWXt7Lb3P mOgDGDx7nXcayyFH1e4C79FDwu6xJ7chrQsyQWIr+ZQVvfAyNxzqS8P6Hd4CxEU9k7XIY7l1BriHu kL0LJluVR6A8lXvQWSoZI3TJAEZJcr0ySA7Y0mSYO+KpSzZYiUXKVg39tQa7RV7W6URmB51nn/SCp 2WvIch7hLU6utswkEYV/li0kV+NUdjYJSP/EsUGZL660FCkOw55v6kmA5GxGStfVseujlNodizJbk gki8B+Mw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1ppgSj-00B37o-1L; Fri, 21 Apr 2023 02:25:25 +0000 Date: Fri, 21 Apr 2023 03:25:25 +0100 From: Al Viro To: David Howells Cc: Jens Axboe , Christoph Hellwig , Matthew Wilcox , Jan Kara , Jeff Layton , David Hildenbrand , Jason Gunthorpe , Logan Gunthorpe , Hillf Danton , Christian Brauner , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig , John Hubbard Subject: Re: [PATCH v18 09/15] iov_iter: Kill ITER_PIPE Message-ID: <20230421022525.GX3390869@ZenIV> References: <20230314220757.3827941-1-dhowells@redhat.com> <20230314220757.3827941-10-dhowells@redhat.com> <20230420222231.GT3390869@ZenIV> <20230420223657.GV3390869@ZenIV> <20230421011145.GW3390869@ZenIV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230421011145.GW3390869@ZenIV> X-Rspam-User: X-Rspamd-Queue-Id: 398431A0015 X-Rspamd-Server: rspam09 X-Stat-Signature: wgwfkbrf7pqsaihqc6qazgqd8p71738a X-HE-Tag: 1682043950-551420 X-HE-Meta: U2FsdGVkX1/jExm8Y9DBqYCWhs0h6aq3lpJtNQqS0rpMMtvilNLKhQjboXDrNT3dA/OSFeHr0UwI3OFgLXjqgv7Arw4Hao+1FliRlQJHYwpLIce5MWL8ILWdMNSsZKAl47wJeLpfjaxcXKekVp8VC4lK1Xb4YHe8Gvs4i2ipCKJIdYcT8s6a4V95M2xMSlunGaYvyuGzQMOLynTnaVoCX7WGfpC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kzvf+EOHfQHux6UR53u6qKVEDFgs0c1suZGAC0NBvUrpr53SllVKcQ8pV3MMPsmc63ISystNxT4= 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 Fri, Apr 21, 2023 at 02:11:45AM +0100, Al Viro wrote: > On Thu, Apr 20, 2023 at 11:36:57PM +0100, Al Viro wrote: > > > Don't get me wrong - I'd love to kill ITER_PIPE off; it's just that tons > > of ->splice_read() duplicating the corresponding ->read_iter() up to the > > point where it would call generic_file_read_iter(), modulo ignoring > > O_DIRECT case and then calling filemap_splice_read() instead... Painful > > and asking for trouble down the road. > > FWIW, broken in this series: > * a bunch of 9p variants (those could probably switch to direct) > * afs > * ceph (very likely) > * ecryptfs (atime propagation) > * dax on various filesystems (probably) > * f2fs > * gfs2 > * nfs > * ocfs2 > * orangefs > * xfs > * zonefs (probably) > * splice from UDP sockets, unless I'm misreading something. > Your sock_splice_read() still falls back to generic_file_splice_read(), > rather than to direct_splice_read() and sockets don't have O_DIRECT > in flags. Neither do they have associated page cache ;-) > > Sure, we could provide a bunch of ->splice_read(), but then we'd have to make > sure that all subsequent changes to matching ->read_iter() get duplicated - > unless they are on O_DIRECT-only paths, that is... OK, how about the following modification of ITER_PIPE? * buffers might extend past the current position * buffers (as now) are either data or zero-copy ones. * advance past the end of data => allocate data-type buffers and fill with zeroes. * copying data to area prior to the end of buffers => each zero-copy-type buffer is converted to a data one; data is copied, but WTF else can you do? If there's a page borrowed from page cache, we can't change its contents anyway. * zero-copy of a page into an area overlapping the existing buffers => treat as data copy for the overlapping part and zero-copy the rest (if any) in normal fashion. * iov_iter_get_pages(): convert everything involved into data-type buffers first, then give caller references to that. Zero-fill new pages (if any). * iov_iter_revert() does *NOT* truncate anything * truncation of stuff past the current position is done by generic_file_splice_read() not only in error case, but on success as well - starting at the end of actually read data, of course. That would make for seekable ITER_PIPE, with zero-copy working for normal cases. I agree that O_DIRECT would probably be better off with ITER_BVEC. Comments?