Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp797073pxp; Fri, 11 Mar 2022 15:23:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwli+BZ2peFjAdyWFIj5gqDAetq5LUhlug8HRT6acLYIY3ot0xOWiHfhksheV2LZ+565rOd X-Received: by 2002:a65:6a13:0:b0:373:14f6:5d33 with SMTP id m19-20020a656a13000000b0037314f65d33mr10608889pgu.62.1647041036998; Fri, 11 Mar 2022 15:23:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647041036; cv=none; d=google.com; s=arc-20160816; b=aZz9oLJLrDMirRLOyM1GT3ZzhIDw9rVh5fsHZCh8vJiin8wf3Q8YjbRWr3AGEhxI9E XBoJ4c1Tk7oHXQShQUr9UuuDTcIkxxljX84/5OgLUUOoMcoOs8RzwclrGqnxH536s+yF T4ZD83Sa4gDKDUoPT8IrkVduXIOs2ciwEhZtEQjY3LsXE4Bs+8VG7w+acUCfFikdfypz 7W1d+VEhTAzxD1ba0GGirPqotWpUgjwQmiL18GQhfJbZcVr9RzfaZa2p+lAyAZ/zU480 UmVoY+cdfzN4Q8vkxNVdSnAKcZwrCfSzKwAuDHZ9tcCY947yaipNVkWK7PT3CzGUbDr2 65Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=f8Z65QU/sPRK6Papy+C6+5xRCDPUUsts1NEh7BhXLpw=; b=1ADyAI9yGWONijSQCY89luUhuHk+mUYa1wvIDHkyi0U3d+cahduMJwb/EwxomWUSyu UJ89GIBH5SZsmVbanh2Aa6Iztw396fZS0f6OgjhzOLJn+pPGzgZzITKnvtP/VKnjejDr gRRc8utqujG4lPJIiAeagxGMkiuZjKiWE2rJx2wGWmCx5kkY9XkT6W1biN/zE5ZCnkCH Vq/+A8UFkQXtMday4HqodcMLvj2ibTcXDzdzLrgpIztBvQ8NYxVU4vy47RegnUA3mlrL RC1aRdX2aqHbKGXOob9c3b22Jhuq9qBRvA5UfRHwGlQgYR55HmLJFbflGDPnoOxvqUL0 qU/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XyWzm03Q; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q25-20020a635059000000b0036c231afb1dsi8464482pgl.733.2022.03.11.15.23.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 15:23:56 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XyWzm03Q; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9944A3B10E2; Fri, 11 Mar 2022 14:10:33 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237179AbiCKL3R (ORCPT + 99 others); Fri, 11 Mar 2022 06:29:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232676AbiCKL3R (ORCPT ); Fri, 11 Mar 2022 06:29:17 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A980BCFBB6 for ; Fri, 11 Mar 2022 03:28:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646998093; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=f8Z65QU/sPRK6Papy+C6+5xRCDPUUsts1NEh7BhXLpw=; b=XyWzm03Q1Yw5Bh2Z88/Q8DadmXU8cf0vfMhFZ+D32Ck0xhLC972pD00EzsUD3jPoLcRMvE qxqdu87IkxHE6zOVJAWU6JmvNImr8s0TeYu/YI48YwAfgBQPfkie3FkWPDpaan4FS9TSUk PKfcwngYoacyvYDZQ4r+udk3lCJcIVA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-417-VuKjaQc1PfSwskQTQJ_d3Q-1; Fri, 11 Mar 2022 06:28:12 -0500 X-MC-Unique: VuKjaQc1PfSwskQTQJ_d3Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7633C1800D50; Fri, 11 Mar 2022 11:28:11 +0000 (UTC) Received: from [172.16.176.1] (ovpn-64-2.rdu2.redhat.com [10.10.64.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3D67A83281; Fri, 11 Mar 2022 11:28:11 +0000 (UTC) From: "Benjamin Coddington" To: "Trond Myklebust" Cc: linux-nfs@vger.kernel.org Subject: Re: [PATCH v9 14/27] NFS: Improve heuristic for readdirplus Date: Fri, 11 Mar 2022 06:28:10 -0500 Message-ID: In-Reply-To: <28d6a094ddca6e4e6c15e055ec3ef6b10d57cbd3.camel@hammerspace.com> References: <20220227231227.9038-1-trondmy@kernel.org> <20220227231227.9038-2-trondmy@kernel.org> <20220227231227.9038-3-trondmy@kernel.org> <20220227231227.9038-4-trondmy@kernel.org> <20220227231227.9038-5-trondmy@kernel.org> <20220227231227.9038-6-trondmy@kernel.org> <20220227231227.9038-7-trondmy@kernel.org> <20220227231227.9038-8-trondmy@kernel.org> <20220227231227.9038-9-trondmy@kernel.org> <20220227231227.9038-10-trondmy@kernel.org> <20220227231227.9038-11-trondmy@kernel.org> <20220227231227.9038-12-trondmy@kernel.org> <20220227231227.9038-13-trondmy@kernel.org> <20220227231227.9038-14-trondmy@kernel.org> <20220227231227.9038-15-trondmy@kernel.org> <28d6a094ddca6e4e6c15e055ec3ef6b10d57cbd3.camel@hammerspace.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 10 Mar 2022, at 15:15, Trond Myklebust wrote: > > The problem is really that 'ls' (or possibly glibc) is passing in a > pretty huge buffer to the getdents() system call. > > On my setup, that buffer appears to be 80K in size. So what happens is > that we get that first getdents() call, and so we fill the 80K buffer > with as many files as will fit. That can quickly run into several > thousand entries, if the filenames are relatively short. > > Then 'ls' goes through the contents and does a stat() (or a statx()) on > each entry, and so we record the statistics. However that means those > first several thousand entries are indeed going to use cached data, or > force GETATTR to go on the wire. We only start using forced readdirplus > on the second pass. > > Yes, I suppose we could limit getdents() to ignore the buffer size, and > just return fewer entries, however what's the "right" size in that > case? We can return fewer entries on the first call, so for the first pass the right size is NFS_READDIR_CACHE_MISS_THRESHOLD + 1. I sent a patch. > More to the point, how much pain are we going to accept before we give > up trying these assorted heuristics, and just define a readdirplus() > system call modelled on statx()? We cursed ourselves by creating the heuristic, and now we've had to maintain it and try to make everyone happy. The pain for us is when the behavior keeps changing after sites have come to rely on previous performance. I hope you can take a look at the patch. Ben