Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3190040ybt; Mon, 22 Jun 2020 17:54:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyi5Pa5G1kbO4QCaoWhQ8ZnK8pCP8MkftBhxI4nAKqmLNwGWsdB/BKEJUhcHHKoAM/fMUdl X-Received: by 2002:aa7:d613:: with SMTP id c19mr19223972edr.321.1592873686276; Mon, 22 Jun 2020 17:54:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592873686; cv=none; d=google.com; s=arc-20160816; b=ScbUwhrxQmOlJgVWPBHouWPSLf34XSQ+T/bzoP7u7siAJghQXxwF3v7p4Bk/xLsXxt RSbPiUk2uLXIqVUq19R3h9+x3AwMvtRJE75rf+HOR328q0V+toQBr1GhdiPkBy4wVc5K Y3EEdxOQYPPzwkHusaPAnGrsaxe/Hd3+Cv7sfKS8qDieDnqwXWeczFNLzsvdlWiIw2JX Co1cVeXrFZUlxWNgVtzbldIH9ihXgrG3lgB+AktWuiIfL6sJyzaZolbDYY957tFIeUN+ rsWx5PBV0YginFmDaMcx3O+9EmhzlqqgclOXi34fiiOFxE5ZNt5hHnPEAeRR6GT5SopV Fm/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=RRjh+HY7bMQTTrhHJN5Lq1XK0Hf6i+i3Fzsl3QrBoDs=; b=rZYgE2gdmrHRSgopAcgzdK7VVoQsmGi1/EiWum44yXRw9H1N59YxMM1DcDPDnypH16 z5QN5JDFVCCD8GgpbD3TA6+OZWDOnu6u5ut2mf807cPDKR0VPBbtwZr3eMptq5idD848 OIEG662ZiRq2YG42X4id3t6yr2CwBGamYX8Qgu3+Rb7IraaIAkqFc2UG0VFByjgCE4Af BQchT73gpVsKBRG3WEOeFxlV+FTtWk/0EHoyvCR6Yrx+rb7eQ4DFo24zhtNlzX5oTvm4 MG+mpOBPGU91qB8kinp53NwbFYtMsN3IxwCnX/MHtNNU9Drda74unKYzshHgIJPnt8+d S4zQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 o10si5925990ejx.722.2020.06.22.17.54.24; Mon, 22 Jun 2020 17:54:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732360AbgFWAwX (ORCPT + 99 others); Mon, 22 Jun 2020 20:52:23 -0400 Received: from mail106.syd.optusnet.com.au ([211.29.132.42]:35737 "EHLO mail106.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731750AbgFWAwX (ORCPT ); Mon, 22 Jun 2020 20:52:23 -0400 Received: from dread.disaster.area (pa49-180-124-177.pa.nsw.optusnet.com.au [49.180.124.177]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 45CB65AF5E4; Tue, 23 Jun 2020 10:52:18 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1jnXAg-0001Y7-9C; Tue, 23 Jun 2020 10:52:18 +1000 Date: Tue, 23 Jun 2020 10:52:18 +1000 From: Dave Chinner To: Andreas Gruenbacher Cc: Matthew Wilcox , linux-fsdevel , Linux-MM , LKML Subject: Re: [RFC] Bypass filesystems for reading cached pages Message-ID: <20200623005218.GF2040@dread.disaster.area> References: <20200619155036.GZ8681@bombadil.infradead.org> <20200622003215.GC2040@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=X6os11be c=1 sm=1 tr=0 a=k3aV/LVJup6ZGWgigO6cSA==:117 a=k3aV/LVJup6ZGWgigO6cSA==:17 a=kj9zAlcOel0A:10 a=nTHF0DUjJn0A:10 a=7-415B0cAAAA:8 a=8G3SpTuCT5XHdoEvo0oA:9 a=P48SZZe_48vTZzb1:21 a=B4xsomyZ1zPHdLA9:21 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 22, 2020 at 04:35:05PM +0200, Andreas Gruenbacher wrote: > On Mon, Jun 22, 2020 at 2:32 AM Dave Chinner wrote: > > On Fri, Jun 19, 2020 at 08:50:36AM -0700, Matthew Wilcox wrote: > > > > > > This patch lifts the IOCB_CACHED idea expressed by Andreas to the VFS. > > > The advantage of this patch is that we can avoid taking any filesystem > > > lock, as long as the pages being accessed are in the cache (and we don't > > > need to readahead any pages into the cache). We also avoid an indirect > > > function call in these cases. > > > > What does this micro-optimisation actually gain us except for more > > complexity in the IO path? > > > > i.e. if a filesystem lock has such massive overhead that it slows > > down the cached readahead path in production workloads, then that's > > something the filesystem needs to address, not unconditionally > > bypass the filesystem before the IO gets anywhere near it. > > I'm fine with not moving that functionality into the VFS. The problem > I have in gfs2 is that taking glocks is really expensive. Part of that > overhead is accidental, but we definitely won't be able to fix it in > the short term. So something like the IOCB_CACHED flag that prevents > generic_file_read_iter from issuing readahead I/O would save the day > for us. Does that idea stand a chance? I have no problem with a "NOREADAHEAD" flag being passed to generic_file_read_iter(). It's not a "already cached" flag though, it's a "don't start any IO" directive, just like the NOWAIT flag is a "don't block on locks or IO in progress" directive and not an "already cached" flag. Readahead is something we should be doing, unless a filesystem has a very good reason not to, such as the gfs2 locking case here... Cheers, Dave. -- Dave Chinner david@fromorbit.com