summaryrefslogtreecommitdiffstats
path: root/sys/fs/nfs
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2013-08-14 21:11:26 +0000
committerrmacklem <rmacklem@FreeBSD.org>2013-08-14 21:11:26 +0000
commit802b1728d8a3d2a016628022a7631f365f00e337 (patch)
treea20eea4fffded2fee18dcd50c288a819ea803066 /sys/fs/nfs
parent79360f25fc862bef26d62d9fd2ec20d0de41756e (diff)
downloadFreeBSD-src-802b1728d8a3d2a016628022a7631f365f00e337.zip
FreeBSD-src-802b1728d8a3d2a016628022a7631f365f00e337.tar.gz
Fix several performance related issues in the new NFS server's
DRC for NFS over TCP. - Increase the size of the hash tables. - Create a separate mutex for each hash list of the TCP hash table. - Single thread the code that deletes stale cache entries. - Add a tunable called vfs.nfsd.tcphighwater, which can be increased to allow the cache to grow larger, avoiding the overhead of frequent scans to delete stale cache entries. (The default value will result in frequent scans to delete stale cache entries, analagous to what the pre-patched code does.) - Add a tunable called vfs.nfsd.cachetcp that can be used to disable DRC caching for NFS over TCP, since the old NFS server didn't DRC cache TCP. It also adjusts the size of nfsrc_floodlevel dynamically, so that it is always greater than vfs.nfsd.tcphighwater. For UDP the algorithm remains the same as the pre-patched code, but the tunable vfs.nfsd.udphighwater can be used to allow the cache to grow larger and reduce the overhead caused by frequent scans for stale entries. UDP also uses a larger hash table size than the pre-patched code. Reported by: wollman Tested by: wollman (earlier version of patch) Submitted by: ivoras (earlier patch) Reviewed by: jhb (earlier version of patch) MFC after: 1 month
Diffstat (limited to 'sys/fs/nfs')
-rw-r--r--sys/fs/nfs/nfsport.h5
-rw-r--r--sys/fs/nfs/nfsrvcache.h10
2 files changed, 9 insertions, 6 deletions
diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h
index f0e20f1..cec50a6 100644
--- a/sys/fs/nfs/nfsport.h
+++ b/sys/fs/nfs/nfsport.h
@@ -603,11 +603,6 @@ void nfsrvd_rcv(struct socket *, void *, int);
#define NFSREQSPINLOCK extern struct mtx nfs_req_mutex
#define NFSLOCKREQ() mtx_lock(&nfs_req_mutex)
#define NFSUNLOCKREQ() mtx_unlock(&nfs_req_mutex)
-#define NFSCACHEMUTEX extern struct mtx nfs_cache_mutex
-#define NFSCACHEMUTEXPTR (&nfs_cache_mutex)
-#define NFSLOCKCACHE() mtx_lock(&nfs_cache_mutex)
-#define NFSUNLOCKCACHE() mtx_unlock(&nfs_cache_mutex)
-#define NFSCACHELOCKREQUIRED() mtx_assert(&nfs_cache_mutex, MA_OWNED)
#define NFSSOCKMUTEX extern struct mtx nfs_slock_mutex
#define NFSSOCKMUTEXPTR (&nfs_slock_mutex)
#define NFSLOCKSOCK() mtx_lock(&nfs_slock_mutex)
diff --git a/sys/fs/nfs/nfsrvcache.h b/sys/fs/nfs/nfsrvcache.h
index 30f757a..5c9dc57 100644
--- a/sys/fs/nfs/nfsrvcache.h
+++ b/sys/fs/nfs/nfsrvcache.h
@@ -41,8 +41,9 @@
#define NFSRVCACHE_MAX_SIZE 2048
#define NFSRVCACHE_MIN_SIZE 64
-#define NFSRVCACHE_HASHSIZE 20
+#define NFSRVCACHE_HASHSIZE 500
+/* Cache table entry. */
struct nfsrvcache {
LIST_ENTRY(nfsrvcache) rc_hash; /* Hash chain */
TAILQ_ENTRY(nfsrvcache) rc_lru; /* UDP lru chain */
@@ -104,4 +105,11 @@ struct nfsrvcache {
LIST_HEAD(nfsrvhashhead, nfsrvcache);
+/* The fine-grained locked cache hash table for TCP. */
+struct nfsrchash_bucket {
+ struct mtx mtx;
+ char lock_name[16];
+ struct nfsrvhashhead tbl;
+};
+
#endif /* _NFS_NFSRVCACHE_H_ */
OpenPOWER on IntegriCloud