MFV r269224:
Increase default ARC buf_hash_table size. When typical block size is small, the hash table could be too small, which would lead to long hash chains and limit performance for cached reads. A new loader tunable, vfs.zfs.arc_average_blocksize, have been added which allows users to override the default assumption of average (typical) block size. Old default was 65536 (64 KiB) and new default is 8192 (8 KiB). Illumos issue: 5034 ARC's buf_hash_table is too small MFC after: 2 weeks
This commit is contained in:
commit
9b046b421f
@ -203,6 +203,7 @@ int zfs_arc_grow_retry = 0;
|
||||
int zfs_arc_shrink_shift = 0;
|
||||
int zfs_arc_p_min_shift = 0;
|
||||
int zfs_disable_dup_eviction = 0;
|
||||
uint64_t zfs_arc_average_blocksize = 8 * 1024; /* 8KB */
|
||||
|
||||
TUNABLE_QUAD("vfs.zfs.arc_meta_limit", &zfs_arc_meta_limit);
|
||||
SYSCTL_DECL(_vfs_zfs);
|
||||
@ -210,6 +211,9 @@ SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_max, CTLFLAG_RDTUN, &zfs_arc_max, 0,
|
||||
"Maximum ARC size");
|
||||
SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_min, CTLFLAG_RDTUN, &zfs_arc_min, 0,
|
||||
"Minimum ARC size");
|
||||
SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_average_blocksize, CTLFLAG_RDTUN,
|
||||
&zfs_arc_average_blocksize, 0,
|
||||
"ARC average blocksize");
|
||||
|
||||
/*
|
||||
* Note that buffers can be in one of 6 states:
|
||||
@ -1054,10 +1058,11 @@ buf_init(void)
|
||||
|
||||
/*
|
||||
* The hash table is big enough to fill all of physical memory
|
||||
* with an average 64K block size. The table will take up
|
||||
* totalmem*sizeof(void*)/64K (eg. 128KB/GB with 8-byte pointers).
|
||||
* with an average block size of zfs_arc_average_blocksize (default 8K).
|
||||
* By default, the table will take up
|
||||
* totalmem * sizeof(void*) / 8K (1MB per GB with 8-byte pointers).
|
||||
*/
|
||||
while (hsize * 65536 < (uint64_t)physmem * PAGESIZE)
|
||||
while (hsize * zfs_arc_average_blocksize < (uint64_t)physmem * PAGESIZE)
|
||||
hsize <<= 1;
|
||||
retry:
|
||||
buf_hash_table.ht_mask = hsize - 1;
|
||||
|
Loading…
Reference in New Issue
Block a user