Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6829329pxb; Wed, 17 Feb 2021 14:53:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwoqWzcyK69K1a63LcfZCsFdbdqAB5ZXwPd+WVOFoWg5Md8vqZgSFVzHqiX0a8uypiZOIWv X-Received: by 2002:aa7:d58e:: with SMTP id r14mr1055060edq.332.1613602427815; Wed, 17 Feb 2021 14:53:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613602427; cv=none; d=google.com; s=arc-20160816; b=i0F+bQh47abVQovpjFESgbqrXSCBdUrXwCCBlLjAo/unymLX4p7VNiO0mI6jeIlCU2 1CkhgsK+GTlQ1ca4WVCvRYinsCOOvEQcTZApnx9OfmbcB+mUctt+V82YWeEXBbaiF/kM MHwFz0icMDlsWR01hQzrbY/8BCdjOYcRWhD+4sjZ9rh+rnmteXhg5pDHBa1/b1XbbRu3 AgpFHbwcjmL489JRNnoYBCXhHFNIu9GZi2aRaVzji/MaeR4nJM+cHB92rwlUaw+c1VXb /M42QC9buet2c0XUTGYF0/wx3btkQkfnpFNoFOMuLjJAJtHLUF6Jz/kVBPvn72og0oo9 E6Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=exGxKvz2dkO6Ia4BmvggC59Ll6D9+WqpkO0LLDpW53U=; b=Y5fSilOg6M02eJliZX7MCFMqpWncpZZeCJnAevRFKymiXyFhN7/vhoeHNXQcoN/u0i fWSi9bjT7Yh3n1nssrCuxHUd6nDgcO3kLqZiCUqXwO99JsAYZh3kFHze2sTSnqoQjz25 VmPfFprGaOoU9w17wuLwqj/5ScfEZc4qe0tuWVMk5frUSxB1NpGYF5jAN2qwGIZNj6wo W+17bbfN0I+AmVlSZRdx6G4WzkqzB2RVjI2INhReUJWSZwLfpbP8UYIlgmJTHEkmN27m MfQwpE4hFdZKapUbE9szOJ1vky61M1PlUlfqUsU0FJpdgqHt6O0zhbFXjzRRSoNs/y7g UgFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=DAsadcKx; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-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 q22si2222915edc.553.2021.02.17.14.53.18; Wed, 17 Feb 2021 14:53:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=DAsadcKx; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232470AbhBQWwz (ORCPT + 99 others); Wed, 17 Feb 2021 17:52:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234021AbhBQWws (ORCPT ); Wed, 17 Feb 2021 17:52:48 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2998C061574; Wed, 17 Feb 2021 14:52:07 -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=exGxKvz2dkO6Ia4BmvggC59Ll6D9+WqpkO0LLDpW53U=; b=DAsadcKxmsU6ocqG684beBo7F/ pwtwAkJtxmTMpf4Yaf/uMliVqkqw8h9mTKmhc9jES0ZyI7WcfPT69f5KQCv6xNKgnrvwupFO9uIti qu+Lr192QSZBD65r5vcrpJeRgG7Wk6phDdZTZ6QSzm2L8F6/Rw6yoDPMSkwF70J9djiWPgzhM4bzW gbH8VzVJvY7blol40F8Lb+Vjx+9EPXX+e6l1ggpAsMYqr+Ou3p9dr73qkXHVrSpAjSVNld/S93yLB Nedtkxx4lvJsktlKJ9eFPfP//m8xQ0/weFQAgZU+eqRSoH/EpVvf4qMA+TiHJsM7LqgUgpfBqCbxz t0ekOKRg==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lCVdG-000xt5-Iq; Wed, 17 Feb 2021 22:49:44 +0000 Date: Wed, 17 Feb 2021 22:49:18 +0000 From: Matthew Wilcox To: David Howells Cc: Christoph Hellwig , Mike Marshall , Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet , Alexander Viro , linux-mm@kvack.org, linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, Jeff Layton , David Wysochanski , linux-kernel@vger.kernel.org Subject: Re: [PATCH 03/33] mm: Implement readahead_control pageset expansion Message-ID: <20210217224918.GP2858050@casper.infradead.org> References: <20210217161358.GM2858050@casper.infradead.org> <161340385320.1303470.2392622971006879777.stgit@warthog.procyon.org.uk> <161340389201.1303470.14353807284546854878.stgit@warthog.procyon.org.uk> <1901187.1613601279@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1901187.1613601279@warthog.procyon.org.uk> Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Feb 17, 2021 at 10:34:39PM +0000, David Howells wrote: > Matthew Wilcox wrote: > > > We're defeating the ondemand_readahead() algorithm here. Let's suppose > > userspace is doing 64kB reads, the filesystem is OrangeFS which only > > wants to do 4MB reads, the page cache is initially empty and there's > > only one thread doing a sequential read. ondemand_readahead() calls > > get_init_ra_size() which tells it to allocate 128kB and set the async > > marker at 64kB. Then orangefs calls readahead_expand() to allocate the > > remainder of the 4MB. After the app has read the first 64kB, it comes > > back to read the next 64kB, sees the readahead marker and tries to trigger > > the next batch of readahead, but it's already present, so it does nothing > > (see page_cache_ra_unbounded() for what happens with pages present). > > It sounds like Christoph is right on the right track and the vm needs to ask > the filesystem (and by extension, the cache) before doing the allocation and > before setting the trigger flag. Then we don't need to call back into the vm > to expand the readahead. Doesn't work. You could read my reply to Christoph, or try to figure out how to get rid of https://evilpiepirate.org/git/bcachefs.git/tree/fs/bcachefs/fs-io.c#n742 for yourself. > Also, there's Steve's request to try and keep at least two requests in flight > for CIFS/SMB at the same time to consider. That's not relevant to this problem.