All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jeff Layton <jlayton@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>,
	Trond Myklebust <trondmy@kernel.org>,
	Anna Schumaker <anna@kernel.org>,
	linux-nfs@vger.kernel.org
Subject: Re: [PATCH 4/4] NFS: use a hash table for delegation lookup
Date: Mon, 14 Jul 2025 15:18:44 +0200	[thread overview]
Message-ID: <20250714131844.GA9138@lst.de> (raw)
In-Reply-To: <fe1eccd60b2eff90f763aca232875d13643083fd.camel@kernel.org>

On Mon, Jul 14, 2025 at 09:14:27AM -0400, Jeff Layton wrote:
> > +	delegation_buckets = roundup_pow_of_two(nfs_delegation_watermark / 16);
> > +	server->delegation_hash_mask = delegation_buckets - 1;
> > +	server->delegation_hash_table = kmalloc_array(delegation_buckets,
> > +			sizeof(*server->delegation_hash_table), GFP_KERNEL);
> > +	if (!server->delegation_hash_table)
> > +		goto out_free_server;
> > +	for (i = 0; i < delegation_buckets; i++)
> > +		INIT_HLIST_HEAD(&server->delegation_hash_table[i]);
> > +
> 
> This is going to get created for any mount, even v3 ones. It might be
> better to only bother with this for v4 mounts. Maybe do this in
> nfs4_server_common_setup() instead?

Yeah, good idea.

> Also, I wonder if you'd be better off using the rhashtable
> infrastructure instead of adding a fixed-size one? The number of
> delegations in flight is very workload-dependent, so a resizeable
> hashtable may be a better option.

I did try that first.  But the rhashtable expects the hash key to
be embedded into the structure that has the rhash_head embedded into
it, while delegations use the file handle embeded into the inode as
the key.  So we'd have to bloat the deleations with a key copy for
that.


  reply	other threads:[~2025-07-14 13:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-14 11:16 use a hash for looking up delegation Christoph Hellwig
2025-07-14 11:16 ` [PATCH 1/4] NFS: cleanup nfs_inode_reclaim_delegation Christoph Hellwig
2025-07-14 13:06   ` Jeff Layton
2025-07-14 11:16 ` [PATCH 2/4] NFS: move the delegation_watermark module parameter Christoph Hellwig
2025-07-14 13:06   ` Jeff Layton
2025-07-15  8:03     ` Christoph Hellwig
2025-07-15 11:15       ` Jeff Layton
2025-07-14 11:16 ` [PATCH 3/4] NFS: track active delegations per-server Christoph Hellwig
2025-07-14 13:07   ` Jeff Layton
2025-07-14 11:16 ` [PATCH 4/4] NFS: use a hash table for delegation lookup Christoph Hellwig
2025-07-14 13:14   ` Jeff Layton
2025-07-14 13:18     ` Christoph Hellwig [this message]
2025-07-15  8:58     ` Christoph Hellwig
2025-07-15 11:19       ` Jeff Layton
  -- strict thread matches above, loose matches on Subject: below --
2025-07-16 13:26 use a hash for looking up delegation v2 Christoph Hellwig
2025-07-16 13:26 ` [PATCH 4/4] NFS: use a hash table for delegation lookup Christoph Hellwig
2025-07-17  4:35   ` kernel test robot
2025-07-17  5:13     ` Christoph Hellwig
2025-07-17 16:00       ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250714131844.GA9138@lst.de \
    --to=hch@lst.de \
    --cc=anna@kernel.org \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trondmy@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.