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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 2644CC433E0 for ; Mon, 11 Jan 2021 00:19:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BE81A229CA for ; Mon, 11 Jan 2021 00:19:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726982AbhAKATW (ORCPT ); Sun, 10 Jan 2021 19:19:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726049AbhAKATW (ORCPT ); Sun, 10 Jan 2021 19:19:22 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAD43C061786; Sun, 10 Jan 2021 16:18:41 -0800 (PST) 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=rRfpg+NyeZkkosMsL/GGMa7wDSV2EgRrAhugKvP5dDc=; b=Cmobwypg8XD0xhRhTMPT42v6yB JpO7FS8VhJnwoM1xHAgY4CdiW7p8pAr5BU04gfn0jxSV+ZUs4lM7dpuWyqdfToqwtXYOka2xbcp6o ekdFuKVrTVJppbf2qKHuvmaAdWpcpnMPcnmD8daVivpg/EKIEhLbAFBD8+dQ5P7Kduf29K4q4KBpB O3jZNpHmE2JNSoNCbJGIW0efQA2rFOi4bSHwRcVmLgq3bVf9RVXZqHbMZtvbAZmYor53RRtYjeAU8 TVjFldcEI1vdSFednSXxNpES+myoShOyo4NL8vjm4Emj2g4c39xFX6e7mzuSzv/jO7f6tBC1EZ92l Wpzw+lBg==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1kykuL-002VOv-NN; Mon, 11 Jan 2021 00:18:06 +0000 Date: Mon, 11 Jan 2021 00:18:05 +0000 From: Matthew Wilcox To: Mikulas Patocka Cc: Al Viro , Andrew Morton , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Jan Kara , Steven Whitehouse , Eric Sandeen , Dave Chinner , Theodore Ts'o , Wang Jianchao , "Kani, Toshi" , "Norton, Scott J" , "Tadakamadla, Rajesh" , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nvdimm@lists.01.org Subject: Re: Expense of read_iter Message-ID: <20210111001805.GD35215@casper.infradead.org> References: <20210107151125.GB5270@casper.infradead.org> <20210110061321.GC35215@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 10, 2021 at 04:19:15PM -0500, Mikulas Patocka wrote: > I put counters into vfs_read and vfs_readv. > > After a fresh boot of the virtual machine, the counters show "13385 4". > After a kernel compilation they show "4475220 8". > > So, the readv path is almost unused. > > My reasoning was that we should optimize for the "read" path and glue the > "readv" path on the top of that. Currently, the kernel is doing the > opposite - optimizing for "readv" and glueing "read" on the top of it. But it's not about optimising for read vs readv. read_iter handles a host of other cases, such as pread(), preadv(), AIO reads, splice, and reads to in-kernel buffers. Some device drivers abused read() vs readv() to actually return different information, depending which you called. That's why there's now a prohibition against both. So let's figure out how to make iter_read() perform well for sys_read().