HomeFreeBSD

nfscl: Use hash lists to improve expected search performance for opens

Description

nfscl: Use hash lists to improve expected search performance for opens

A problem was reported via email, where a large (130000+) accumulation
of NFSv4 opens on an NFSv4 mount caused significant lock contention
on the mutex used to protect the client mount's open/lock state.
Although the root cause for the accumulation of opens was not
resolved, it is obvious that the NFSv4 client is not designed to
handle 100000+ opens efficiently. When searching for an open,
usually for a match by file handle, a linear search of all opens
is done.

Commit 3f7e14ad9345 added a hash table of lists hashed on file handle
for the opens. This patch uses the hash lists for searching for
a matching open based of file handle instead of an exhaustive
linear search of all opens.
This change appears to be performance neutral for a small number
of opens, but should improve expected performance for a large
number of opens. This patch also moves any found match to the front
of the hash list, to try and maintain the hash lists in recently
used ordering (least recently used at the end of the list).

This commit should not affect the high level semantics of open
handling.

(cherry picked from commit 724072ab1d588677a83a5a5011b5ad9ff5d56538)

Details

Provenance
rmacklemAuthored on May 25 2021, 9:19 PM
Parents
rG658f5eed38c3: linuxkpi: Add macros for might_lock_nested() and lockdep_(re/un/)pin_lock()
Branches
Unknown
Tags
Unknown