Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5335244iog; Wed, 22 Jun 2022 17:46:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tyLBl2lHeLBy28EcCnvCfCSBnFlCDHL7vgSvJWWy+PFvYkLagG1nHE/B5MvtkJULOk5Pri X-Received: by 2002:a17:907:2d09:b0:722:f0bf:ac26 with SMTP id gs9-20020a1709072d0900b00722f0bfac26mr5710016ejc.77.1655945191452; Wed, 22 Jun 2022 17:46:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655945191; cv=none; d=google.com; s=arc-20160816; b=P1KXD/LthJtT1vW8T4Jytv5W9g7ETOq74orrWSj2/Vh39AxBR693+SpnPIgJm1gRaN Mcs68XdeBn+Aj1ueMZQMPyvthmy4UkAM3gpGuFznKUzj+9d2ly81XbrE35otu4WJ1Ahk TxMXCJq3IDvIGQwkwZL+4AJoXUVrBo+Eq7LuZmJy1KAWrODwFp/SeWMOPWEZ6L7fWIrW 3czF1HetUCRbLMyDlOHMBvO2c7n4ggzZBV3Wba7Iy6QpuNVtis96X7/BMWJLp9395ti8 gMmTbpsuyTWa9Q6oV7hA77WYMPnyHFaQpANYkQRpn1WligYCKnOE/o9XBSDZiEm64jA/ s9rQ== 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; bh=jIYIEInSMfFzGa8A6evXvUzRAL0B2piRC1geD44QJ24=; b=zvNmrMrISfPvm3tKqyhQIAwcXCCaWl5cLplkQHKHrtOkOd6z7KPLtyNWV890QX6eTM pIZ/XtXEm7pMep7FJr7IIXJrnwSQCF757E/FrXeo618nd2U4lp4osM/03J9ENCkAKfw3 S8bPtMy9UV9AWegIYqsdKYbIVtTH2L8wI4fMcGYJKt70FKpfPdpwVT+GsDh8807rWuvH rxEylPc3fST6NAxDe/lgA9rQcSdA1dg/LrOpUVGT4MqNz01LcQ70794urjLUpNGc1Y/k pnzCVLkZ8l3BTvoB9SQiRUVxQlri+JWZ3nV+Yi5tvinM0tBgjWWsFSXhlMupBDLilg9z YTnA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m6-20020a17090672c600b0071208964101si3821079ejl.349.2022.06.22.17.45.59; Wed, 22 Jun 2022 17:46:31 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359796AbiFWAib (ORCPT + 99 others); Wed, 22 Jun 2022 20:38:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376443AbiFWAi0 (ORCPT ); Wed, 22 Jun 2022 20:38:26 -0400 Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4F65A2ED61; Wed, 22 Jun 2022 17:38:25 -0700 (PDT) Received: from dread.disaster.area (pa49-181-2-147.pa.nsw.optusnet.com.au [49.181.2.147]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 067F610E7966; Thu, 23 Jun 2022 10:38:23 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1o4ArW-009u4M-PC; Thu, 23 Jun 2022 10:38:22 +1000 Date: Thu, 23 Jun 2022 10:38:22 +1000 From: Dave Chinner To: Chuck Lever Cc: linux-nfs@vger.kernel.org, netdev@vger.kernel.org, tgraf@suug.ch, jlayton@redhat.com Subject: Re: [PATCH RFC 29/30] NFSD: Convert the filecache to use rhashtable Message-ID: <20220623003822.GF1098723@dread.disaster.area> References: <165590626293.75778.9843437418112335153.stgit@manet.1015granger.net> <165590735674.75778.2489188434203366753.stgit@manet.1015granger.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <165590735674.75778.2489188434203366753.stgit@manet.1015granger.net> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.4 cv=OJNEYQWB c=1 sm=1 tr=0 ts=62b3b600 a=ivVLWpVy4j68lT4lJFbQgw==:117 a=ivVLWpVy4j68lT4lJFbQgw==:17 a=kj9zAlcOel0A:10 a=JPEYwPQDsx4A:10 a=VwQbUJbxAAAA:8 a=yPCof4ZbAAAA:8 a=7-415B0cAAAA:8 a=48opyrbEDHdIh8SDB-IA:9 a=CjuIK1q_8ugA:10 a=AjGcO6oz07-iQ99wixmX:22 a=biEYGPWJfzWAr4FL6Ov7:22 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,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 Wed, Jun 22, 2022 at 10:15:56AM -0400, Chuck Lever wrote: > Enable the filecache hash table to start small, then grow with the > workload. Smaller server deployments benefit because there should > be lower memory utilization. Larger server deployments should see > improved scaling with the number of open files. > > I know this is a big and messy patch, but there's no good way to > rip out and replace a data structure like this. > > Suggested-by: Jeff Layton > Signed-off-by: Chuck Lever Pretty sure I mentioned converting to rhashtable as well when we were talking about the pointer-chasing overhead of list and tree based indexing of large caches. :) > + > +/* > + * Atomically insert a new nfsd_file item into nfsd_file_rhash_tbl. > + * > + * Return values: > + * %NULL: @new was inserted successfully > + * %A valid pointer: @new was not inserted, a matching item is returned > + * %ERR_PTR: an unexpected error occurred during insertion > + */ > +static struct nfsd_file *nfsd_file_insert(struct nfsd_file *new) > +{ > + struct nfsd_file_lookup_key key = { > + .type = NFSD_FILE_KEY_FULL, > + .inode = new->nf_inode, > + .need = new->nf_flags, > + .net = new->nf_net, > + .cred = current_cred(), > + }; > + struct nfsd_file *nf; > + > + nf = rhashtable_lookup_get_insert_key(&nfsd_file_rhash_tbl, > + &key, &new->nf_rhash, > + nfsd_file_rhash_params); > + if (!nf) > + return nf; The insert can return an error (e.g. -ENOMEM) so need to check IS_ERR(nf) here as well. Cheers, Dave. -- Dave Chinner david@fromorbit.com