Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp806375ybn; Tue, 24 Sep 2019 09:47:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOQDGH1seuDgvK8lcL+Qhjh8EVjcGXbWcfrgpuP+2tHkp43LI1x+47YZfI/B+XgDQOdIw3 X-Received: by 2002:adf:e812:: with SMTP id o18mr3256266wrm.398.1569343656252; Tue, 24 Sep 2019 09:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569343656; cv=none; d=google.com; s=arc-20160816; b=IRGQhMXU3WjvDkllF9jqbcciSN8dFwG8WDt9mrZz/XpZyGsPz795q2ACN63oK25Q8y 8euWUawejfg1Rs8B61e6xMBohjul99QxQTI9DO8zJ8Tb9efEUmH9bYcDPh+zSYmgUIpO o4dmKDwxMHV4vYYVRWClPI42ShmEBJET20moYwGLRtdqRkkznIT2WGuB59WOnRru9QKO Tib4Mzbs3BT8AM1Dzc20FHtM53OI9WN5+jzD9yEBAqpe72SBmgKjtZiOTNNBMBCU9q+e 90aAs+S5jGCMSyDSuh3raXzNhffuzUXcrksSiTWprS55rKgsxWDJG0ZBNUuooXpr9/Mw fcdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ecG1bmTShe60pG2RED2U4z+fupj7aQkwqDk6tWfgYaQ=; b=0STRkUOI2CZ5gC3rO4dBZzOpPyztjzDv6wwHv+YZrJ8gHO6bcrhsfDS+/SPwSOwQA7 R460Hj0KVbB6mzaZHU/FWRWM214/lZGBCTKIeD5KhB+I8LcX9NCPZBOf3Vg/QIjLsurJ ZNsJpppLMGq5UibFEAo8pE/vfZqqz27drI2/O75bIDEnCb2p8cmPVlw1LFUtIrdasVUQ J/zep0fhjQCI/XMY3G1vvqfjGqjw2N/yXqTgAS+UCr0J/lsHXO0tdkcYbSkvRPo1egCm w2wTlHJXtapD7euGbbmhEnEnXxz2MQC0knSwiliHWPhGfBakHBhWFQx/GQnFdHOjOt6O 7UFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nCFwVsKb; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e47si1588684ede.325.2019.09.24.09.47.11; Tue, 24 Sep 2019 09:47:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nCFwVsKb; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404463AbfIWGg7 (ORCPT + 99 others); Mon, 23 Sep 2019 02:36:59 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:32965 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404364AbfIWGg7 (ORCPT ); Mon, 23 Sep 2019 02:36:59 -0400 Received: by mail-wm1-f67.google.com with SMTP id r17so14187339wme.0 for ; Sun, 22 Sep 2019 23:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ecG1bmTShe60pG2RED2U4z+fupj7aQkwqDk6tWfgYaQ=; b=nCFwVsKb4CIP+mvaCUNjTNxXaM62n6mNYJ1d7Ui/I5EwBYv6zgMGxXB2rk4eFxlcAH AryC0BslBHCguXqgdNFL2E2CzWo4nstgUtMQcd7MTUZNHOVBYu1pRf+bAYJoESNTDtzv jAK3SyEalVv1GxVTg9f7emC+N4ZcN0EaeUPzHmggUpbzxW/X+xYESF7U2SAGbpoLNWhC a6UDds+N/d4LKLVfsyIDQTliEATK1DPfcpKJxrgmsBXkRsuVswRLhQpr0BVKV8vXsgEO 2mdYmGiNPyaXSVUMp+xDdTsqfqQ1/eG1GS2AHAwyU4o95u3dFzmrtq3G2Y7ij67m/IFT qeEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ecG1bmTShe60pG2RED2U4z+fupj7aQkwqDk6tWfgYaQ=; b=WBuGIpkE1l8zpvj6RDGKJMhrt5p7uKLvf6FUoGPTGj2uCOn05sKSScAVDFZLf936db s6T53dpoCrBF20FmXW0sgKJH1kDLmrT5afFqgq3dZswqbPCNtwkfbhbXuYEuYheDiuhb qB0WTpRWQaTrogPQ+G3aOkldtSGV2mVmY6YpmeSowcQcUWw54iLkS528NZx5LNhVLfIp N33ydQQtXW9Bok89foGqkWUJXDwMGsxzWHWP8sYXqSXbIiEQP1p80ccI9kUn1jKt3no2 ziqT24+qLUVwoMeeClzy4hMnJcpHMcPl5vnFwZqcXuEdBnI+fBGpUT077HerUCX+hm8U JJBg== X-Gm-Message-State: APjAAAVIVrXwu13B0m+D40xZSuhgNmjwJHCrxqpyBSqxMOHyTk1FhxoR Rdcc0KXKGiAT4eocKFMCxCQrG7Hk X-Received: by 2002:a7b:c5c2:: with SMTP id n2mr1551299wmk.20.1569220617186; Sun, 22 Sep 2019 23:36:57 -0700 (PDT) Received: from [10.161.254.11] (srv1-dide.ioa.sch.gr. [81.186.20.0]) by smtp.googlemail.com with ESMTPSA id v4sm14910015wrg.56.2019.09.22.23.36.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Sep 2019 23:36:56 -0700 (PDT) Subject: Re: [PATCH] NFS: Optimise the default readahead size To: Trond Myklebust , Anna Schumaker Cc: linux-nfs@vger.kernel.org References: <20190922190749.54156-1-trond.myklebust@hammerspace.com> From: Alkis Georgopoulos Message-ID: Date: Mon, 23 Sep 2019 09:36:55 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190922190749.54156-1-trond.myklebust@hammerspace.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Thank you Trond, you're awesome! I don't know if it's appropriate, but I thought I'd send some recent benchmarks about this: Netbooting a system over 100 Mbps,tcp,timeo=600,rsize=1M,wsize=1M, then `rm -rf .mozilla; echo 3>/proc/sys/vm/drop_caches; firefox` | Readahead | Boot sec | Boot MB | Firefox sec | Firefox MB | |-----------|----------|---------|-------------|------------| | 4 KB | 34 | 158 | 27 | 120 | | 128 KB | 36 | 355 | 27 | 247 | | 1 MB | 83 | 1210 | 60 | 661 | If I understand it correctly, the new default is 128 KB, which feels like a great generic default, while for remote / or /home for multiple clients, 4 KB might be more appropriate, so software like LTSP or klibc nfsmount that focus there, may adjust readahead from the /sys/devices/virtual/bdi interface. Thanks again, Alkis Georgopoulos LTSP developer On 9/22/19 10:07 PM, Trond Myklebust wrote: > In the years since the max readahead size was fixed in NFS, a number of > things have happened: > - Users can now set the value directly using /sys/class/bdi > - NFS max supported block sizes have increased by several orders of > magnitude from 64K to 1MB. > - Disk access latencies are orders of magnitude faster due to SSD + NVME. > > In particular note that if the server is advertising 1MB as the optimal > read size, as that will set the readahead size to 15MB. > Let's therefore adjust down, and try to default to VM_READAHEAD_PAGES. > However let's inform the VM about our preferred block size so that it > can choose to round up in cases where that makes sense. > > Reported-by: Alkis Georgopoulos > Signed-off-by: Trond Myklebust > --- > fs/nfs/internal.h | 8 -------- > fs/nfs/super.c | 9 ++++++++- > 2 files changed, 8 insertions(+), 9 deletions(-) > > diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h > index e64f810223be..447a3c17fa8e 100644 > --- a/fs/nfs/internal.h > +++ b/fs/nfs/internal.h > @@ -16,14 +16,6 @@ extern const struct export_operations nfs_export_ops; > > struct nfs_string; > > -/* Maximum number of readahead requests > - * FIXME: this should really be a sysctl so that users may tune it to suit > - * their needs. People that do NFS over a slow network, might for > - * instance want to reduce it to something closer to 1 for improved > - * interactive response. > - */ > -#define NFS_MAX_READAHEAD (RPC_DEF_SLOT_TABLE - 1) > - > static inline void nfs_attr_check_mountpoint(struct super_block *parent, struct nfs_fattr *fattr) > { > if (!nfs_fsid_equal(&NFS_SB(parent)->fsid, &fattr->fsid)) > diff --git a/fs/nfs/super.c b/fs/nfs/super.c > index 703f595dce90..c96194e28692 100644 > --- a/fs/nfs/super.c > +++ b/fs/nfs/super.c > @@ -2627,6 +2627,13 @@ int nfs_clone_sb_security(struct super_block *s, struct dentry *mntroot, > } > EXPORT_SYMBOL_GPL(nfs_clone_sb_security); > > +static void nfs_set_readahead(struct backing_dev_info *bdi, > + unsigned long iomax_pages) > +{ > + bdi->ra_pages = VM_READAHEAD_PAGES; > + bdi->io_pages = iomax_pages; > +} > + > struct dentry *nfs_fs_mount_common(struct nfs_server *server, > int flags, const char *dev_name, > struct nfs_mount_info *mount_info, > @@ -2669,7 +2676,7 @@ struct dentry *nfs_fs_mount_common(struct nfs_server *server, > mntroot = ERR_PTR(error); > goto error_splat_super; > } > - s->s_bdi->ra_pages = server->rpages * NFS_MAX_READAHEAD; > + nfs_set_readahead(s->s_bdi, server->rpages); > server->super = s; > } > >