Few microoptimizations to dbuf layer

Move db_link into the same cache line as db_blkid and db_level.
It allows significantly reduce avl_add() time in dbuf_create() on
systems with large RAM and huge number of dbufs per dnode.

Avoid few accesses to dbuf_caches[].size, which is highly congested
under high IOPS and never stays in cache for a long time.  Use local
value we are receiving from zfs_refcount_add_many() any way.

Remove cache_size_bytes_max bump from dbuf_evict_one().  I don't see
a point to do it on dbuf eviction after we done it on insertion in
dbuf_rele_and_unlock().

Reviewed-by: Matt Ahrens <matt@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #9931
This commit is contained in:
Alexander Motin
2020-02-05 14:08:44 -05:00
committed by GitHub
parent cccbed9f98
commit cbd8f5b759
2 changed files with 16 additions and 28 deletions
+7 -6
View File
@@ -206,6 +206,13 @@ typedef struct dmu_buf_impl {
*/
struct dmu_buf_impl *db_hash_next;
/*
* Our link on the owner dnodes's dn_dbufs list.
* Protected by its dn_dbufs_mtx. Should be on the same cache line
* as db_level and db_blkid for the best avl_add() performance.
*/
avl_node_t db_link;
/* our block number */
uint64_t db_blkid;
@@ -260,12 +267,6 @@ typedef struct dmu_buf_impl {
/* List of dirty records for the buffer sorted newest to oldest. */
list_t db_dirty_records;
/*
* Our link on the owner dnodes's dn_dbufs list.
* Protected by its dn_dbufs_mtx.
*/
avl_node_t db_link;
/* Link in dbuf_cache or dbuf_metadata_cache */
multilist_node_t db_cache_link;