Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp954710pxb; Wed, 29 Sep 2021 13:24:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcKanRGSnldxzP+uZBxhiN9JLrVQvmTTxJh6h5XBHt+LzY4qwpjosQW/0lbMBZeihOFfb3 X-Received: by 2002:a17:902:d34b:b0:13e:417c:3f58 with SMTP id l11-20020a170902d34b00b0013e417c3f58mr1741478plk.14.1632947043058; Wed, 29 Sep 2021 13:24:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632947043; cv=none; d=google.com; s=arc-20160816; b=RsA/ytOJXJy3xck8PSjCqYpTcCcVgaESFbF9rvcbfq6Q68fsHhw8mw9MpQ88jTg2T1 WolopELOuYk+N/106qvgERVRj3DOHDLSSKbP4dpCaX2Oh3kuaLMYNAR9juFkYjygCzwB v1+eo4W+FaVKXoQSibUsX9Rff+BPd+nbYdMQ4tcAW+oXG28kxx9r9ZIztAmD9/Kj0ODR 4UGKwED8AuTybbJWAcxk0NWA2IzuCtdkFtyMDJcXn6BCFLLXK0Jwili5PtmBduxH5+dj riXWNcXLRuxILDZTOoD1B8fngwdjXePmptQTJor18TCvVieKbAE0/+Kidxex6WUihBef u/4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=atdiJKCN1rPb9B1csLecm6E+ZZ9KOVT2cb/f42xSuWo=; b=Bt1TQ3tC6ZObtwrTMSg6M9mQNLjNjMUFxdLUEhNrZJK18ybTRDWQrLwNolIYkwu9Kt ZgNTX/pH53kKap5oIar9yeU21N4KbUXlVArGWsMEMZnckEWZC3Qt2QqUIsOBasUD3+6m 6yE9m4fHk4r7wHYOOsLvxKJc7snYz4DfAdRqNVwd+3s1vlzIF7HqzrmOP2MRDQshOVCJ vZ3ITmgXhchBZta9sDtK1mW8GP5gC3/bel+Q92xPKwdd+9x+qk2zE5FEcJwIMcVJgQaQ +3pSnAec4Ish/ly/23T+6IQzSpQTDmIj2msNzlZveZoA6vEYAXSSxgjW8BpjtqfUBxAg rLHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=inyl4lYT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v1si1222918plg.230.2021.09.29.13.22.28; Wed, 29 Sep 2021 13:24:03 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=inyl4lYT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346575AbhI2UXn (ORCPT + 99 others); Wed, 29 Sep 2021 16:23:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25021 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346369AbhI2UXm (ORCPT ); Wed, 29 Sep 2021 16:23:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632946921; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=atdiJKCN1rPb9B1csLecm6E+ZZ9KOVT2cb/f42xSuWo=; b=inyl4lYT/0rs3AHok9+8wSiE7yN6m6STaZbh4HAeL3ryFMwxrkIAZmi6TPfu3oxC+Ch2aS cyK/qCNzX0oX6Ou+SiztD9en4sXti+F+OrBs7/BT+tiYwnPeNP3+/YgX15NZe5DNRCRU0k 1K0DiY2LCshLKMzPzsXOl8BUTa4Xdn4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-434-DDhi8SIMNueLyRXz8aFd0A-1; Wed, 29 Sep 2021 16:21:59 -0400 X-MC-Unique: DDhi8SIMNueLyRXz8aFd0A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D65FA8B4A9A; Wed, 29 Sep 2021 20:21:24 +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 9058219C59; Wed, 29 Sep 2021 20:21:24 +0000 (UTC) From: "Benjamin Coddington" To: "Trond Myklebust" Cc: linux-nfs@vger.kernel.org Subject: Re: [PATCH 4/5] NFS: Further optimisations for 'ls -l' Date: Wed, 29 Sep 2021 16:21:23 -0400 Message-ID: In-Reply-To: References: <20210929134944.632844-1-trondmy@kernel.org> <20210929134944.632844-2-trondmy@kernel.org> <20210929134944.632844-3-trondmy@kernel.org> <20210929134944.632844-4-trondmy@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 29 Sep 2021, at 12:23, Trond Myklebust wrote: > On Wed, 2021-09-29 at 10:56 -0400, Benjamin Coddington wrote: >> On 29 Sep 2021, at 9:49, trondmy@kernel.org wrote: >> >>> From: Trond Myklebust >>> >>> If a user is doing 'ls -l', we have a heuristic in GETATTR that >>> tells >>> the readdir code to try to use READDIRPLUS in order to refresh the >>> inode >>> attributes. In certain cirumstances, we also try to invalidate the >>> remaining directory entries in order to ensure this refresh. >>> >>> If there are multiple readers of the directory, we probably should >>> avoid >>> invalidating the page cache, since the heuristic breaks down in >>> that >>> situation anyway. >> >> Hi Trond, I'm curious about the motivation for this work because >> we're often >> managing expectations about performance between various workloads.  >> What >> does the workload look like that prompted you to make this >> optimization? >> >> I'm also interested because I have some work that improves readdir >> performance for multiple readers on large directories, but is rotting >> because things have been "good enough" for folks over here. >> > > Are you talking about this patch specifically, or the series in > general? A bit of both - the first two patches didn't really make sense to me, but I get it now. Thanks. > The general motivation for the series is that in certain circumstances > involving a read-only scenario (no changes to the directory) and > multiple processes we're seeing a regression w.r.t. older kernels. > > The motivation for this particular patch is twofold: > 1. I want to get rid of the cached page_index in the inode and > replace it with something less persistent (inodes are forever, > unlike file descriptors). > 2. The heuristic in question is designed to only work in the single > process/single threaded case. Make sense to me now. I'm wondering if this might be creating a READDIR op amplification for N readers sharing the directory's fd because one process can be dropping the cache, which artificially deflates desc->page_index for a given dir_cookie. That lower page_index gets reused on the next pass dropping the cache, and it'll keep using the bottom pages and doing READDIRs. That wasn't possible before because we only invalidated past nfsi->page_index. Maybe an unlikely case (but I think some http servers could behave this way), and I'd have to test it to be sure. I can try to do that unless you think its not possible or concerning. Ben