Skip to content

Remove per-lock-operation nlm_lookup_host() call

Chuck Lever linux-nfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3NFS: Introduce external nlm_host set-up and tear-down functionsfs/lockd/clntlock.c include/linux/lockd/bind.h+62 -00 replies
2/3NFS: Invoke nlmclnt_init during NFS mount processingfs/nfs/client.c include/linux/nfs_fs_sb.h+20 -70 replies
3/3NFS: Use cached nlm_host when calling nlmclnt_proc()fs/lockd/clntproc.c fs/nfs/nfs3proc.c fs/nfs/proc.c +1 more+14 -213 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] Remove per-lock-operation nlm_lookup_host() call

Hi Trond-

Calling nlm_lookup_host() during each NLM operation is a lot of overhead. The nlm_lookup_host() function grabs the nlm_host_mutex, serializing NLM operations and generating extra CPU invalidations on SMP systems.

The nlm_lookup_host() function can also trigger nlm_host garbage collection, and reorders the global nlm_host chain after every successful nlm_host lookup, resulting in extraneous memory write traffic.

In addition, nlmclnt_proc() pokes around in the NFS inode and in the NFS client's rpc_xprt struct, both of which are layering violations that we can and should avoid.

The new architecture pins an nlm_host structure to each NFS client superblock that has the "lock" mount option set. The client passes in the pinned nlm_host structure during each call to nlmclnt_proc(). NFS client unmount processing "puts" the nlm_host so it can be garbage- collected later.

By pinning an nlm_host for each mount point, we trade the overhead of looking up or creating a fresh nlm_host struct during every NLM procedure call for a little extra memory space utilization.

Please consider these patches for 2.6.25.

Sidebar: there are only a few remaining references to the internals of NFS inodes in the client-side NLM code. The only references I found are related to extracting or comparing the inode's file handle via NFS_FH(). One is in nlmclnt_grant(); the other is in nlmclnt_setlockargs().

Signature · 1 line
corporate:    <chuck dot lever at oracle dot com>