Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp940571pxp; Wed, 9 Mar 2022 16:31:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+Ls3e/V5YbMKjV0s5GIFr9CjE3ZMfrk8Yxmow+2C34LrfQIRsQxRNz2AQfnele9u0dO9/ X-Received: by 2002:a17:907:6e24:b0:6d9:43f1:d3ce with SMTP id sd36-20020a1709076e2400b006d943f1d3cemr2061378ejc.166.1646872283935; Wed, 09 Mar 2022 16:31:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646872283; cv=none; d=google.com; s=arc-20160816; b=CxsqTKDCUOyFCvmRW/fBc6mQHX2Zxr7F04idkUJbzc6Zpn7nURHx18UlBrAyqbZk+j +WDt77m3rxxi/okfnnxnf9tYBMy/rn/tbP+KzALCq+CZfhB4V2HB3A4RisdmrHKCL5CA jzQX0YUME9ygDIOcFMua0rFpXQ/3gZh5H/RVjyEgBfmZI4XOJsmVwdwQrixIJbcnv2ko 9dJl21Gyc8mtLfbA6ZePET1+w6XhfYyNsFZmrPw04UAMBrKZDwGtVg0ip1rac+2hpFL7 j9qTiL7rquZXQDqo6zilsnQxeI/Xo1kxFD6oGbGQRczTt6hJQUyTJZD4Y/uRHv5Ld7dt w46g== 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=tpHBdQuPxV5pLsk1Lzsj/uAhsmvPHKj8F/UJMnPqaVY=; b=NYMSQa7JCs7yf1akxBr2YDQOhm/MTl+NXZV1U6tWma5EKZAtxlunQJ9xehHxrcNP8Y fyyQ661/5/WxhgApOmcXWToHQcm3xEc1UcnGG9nlv6rPCltoxQVuSHF0KY4YmxmUdrsr HLxSkKVctacWIHgcLqfYQQkkPQZdqn9n5hTzJYIcHN4PWx77Y04Jk5PbQPhFYA3k/zRA K1DXlCTTOb1VN2jtp6vZqaics05K0drmePYP46wDfoPFXRn7bW7EMUD2wQfJe+PWntvf zTT4WaBcVCxONJTLvgclIQszUUqqZKKZOk/Yo+LHgmE1GwrXKBU/Ijw3W91IuktfcaFC CZ0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ktm1Y5lg; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i11-20020a50fd0b000000b00415a1ff479asi2043371eds.61.2022.03.09.16.30.49; Wed, 09 Mar 2022 16:31:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ktm1Y5lg; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232515AbiCIRk7 (ORCPT + 99 others); Wed, 9 Mar 2022 12:40:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235406AbiCIRk5 (ORCPT ); Wed, 9 Mar 2022 12:40:57 -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 D2865101F05 for ; Wed, 9 Mar 2022 09:39:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646847597; 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=tpHBdQuPxV5pLsk1Lzsj/uAhsmvPHKj8F/UJMnPqaVY=; b=Ktm1Y5lg9GH0TWO82cNL4LaPAxgH60dLy5VrdBitZk6mXtNkk6G316eArQs+5Q2gGXNf++ 8X9tPRv7/LdUdwywqxQdwHZNB7UZdyY5yH2o8gQyu856EyCBfOpIAMB6b40feV3uQcxLwB Lnlbj10DMBBkISZm5K5OqsxEJ1yhOq8= 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-237-9-LNCjZdPaGo5ZpT_HLsqA-1; Wed, 09 Mar 2022 12:39:53 -0500 X-MC-Unique: 9-LNCjZdPaGo5ZpT_HLsqA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B3EF9835DE3; Wed, 9 Mar 2022 17:39:52 +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 6AFEE89288; Wed, 9 Mar 2022 17:39:52 +0000 (UTC) From: "Benjamin Coddington" To: trondmy@kernel.org Cc: linux-nfs@vger.kernel.org Subject: Re: [PATCH v9 14/27] NFS: Improve heuristic for readdirplus Date: Wed, 09 Mar 2022 12:39:51 -0500 Message-ID: In-Reply-To: <20220227231227.9038-15-trondmy@kernel.org> 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> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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 27 Feb 2022, at 18:12, trondmy@kernel.org wrote: > From: Trond Myklebust > > The heuristic for readdirplus is designed to try to detect 'ls -l' and > similar patterns. It does so by looking for cache hit/miss patterns in > both the attribute cache and in the dcache of the files in a given > directory, and then sets a flag for the readdirplus code to interpret. > > The problem with this approach is that a single attribute or dcache miss > can cause the NFS code to force a refresh of the attributes for the > entire set of files contained in the directory. > > To be able to make a more nuanced decision, let's sample the number of > hits and misses in the set of open directory descriptors. That allows us > to set thresholds at which we start preferring READDIRPLUS over regular > READDIR, or at which we start to force a re-read of the remaining > readdir cache using READDIRPLUS. I like this patch very much. The heuristic doesn't kick-in until "ls -l" makes its second call into nfs_readdir(), and for my filenames with 8 chars, that means that there are about 5800 GETATTRs generated before we clean the cache to do more READDIRPLUS. That's a large number to compound on connection latency. We've already got some complaints that folk's 2nd "ls -l" takes "so much longer" after 1a34c8c9a49e. Can we possibly limit our first pass through nfs_readdir() so that the heuristic takes effect sooner? Ben