]> git.proxmox.com Git - mirror_zfs.git/commit
Improved dnode allocation and dmu_hold_impl()
authorOlaf Faaland <faaland1@llnl.gov>
Tue, 5 Sep 2017 23:15:04 +0000 (16:15 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 5 Sep 2017 23:15:04 +0000 (16:15 -0700)
commit4c5b89f59e4e5c8f5b4680040118ebde09598bbe
tree6c63fc45fc34f5294fc7cd89b02c57ec7fe98887
parent65dcb0f67a4d72ee4e1e534703db5caacf1ec85f
Improved dnode allocation and dmu_hold_impl()

Refactor dmu_object_alloc_dnsize() and dnode_hold_impl() to simplify the
code, fix errors introduced by commit dbeb879 (PR #6117) interacting
badly with large dnodes, and improve performance.

* When allocating a new dnode in dmu_object_alloc_dnsize(), update the
percpu object ID for the core's metadnode chunk immediately.  This
eliminates most lock contention when taking the hold and creating the
dnode.

* Correct detection of the chunk boundary to work properly with large
dnodes.

* Separate the dmu_hold_impl() code for the FREE case from the code for
the ALLOCATED case to make it easier to read.

* Fully populate the dnode handle array immediately after reading a
block of the metadnode from disk.  Subsequently the dnode handle array
provides enough information to determine which dnode slots are in use
and which are free.

* Add several kstats to allow the behavior of the code to be examined.

* Verify dnode packing in large_dnode_008_pos.ksh.  Since the test is
purely creates, it should leave very few holes in the metadnode.

* Add test large_dnode_009_pos.ksh, which performs concurrent creates
and deletes, to complement existing test which does only creates.

With the above fixes, there is very little contention in a test of about
200,000 racing dnode allocations produced by tests 'large_dnode_008_pos'
and 'large_dnode_009_pos'.

name                            type data
dnode_hold_dbuf_hold            4    0
dnode_hold_dbuf_read            4    0
dnode_hold_alloc_hits           4    3804690
dnode_hold_alloc_misses         4    216
dnode_hold_alloc_interior       4    3
dnode_hold_alloc_lock_retry     4    0
dnode_hold_alloc_lock_misses    4    0
dnode_hold_alloc_type_none      4    0
dnode_hold_free_hits            4    203105
dnode_hold_free_misses          4    4
dnode_hold_free_lock_misses     4    0
dnode_hold_free_lock_retry      4    0
dnode_hold_free_overflow        4    0
dnode_hold_free_refcount        4    57
dnode_hold_free_txg             4    0
dnode_allocate                  4    203154
dnode_reallocate                4    0
dnode_buf_evict                 4    23918
dnode_alloc_next_chunk          4    4887
dnode_alloc_race                4    0
dnode_alloc_next_block          4    18

The performance is slightly improved for concurrent creates with
16+ threads, and unchanged for low thread counts.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #5396
Closes #6522
Closes #6414
Closes #6564
cmd/zdb/zdb.c
include/sys/dnode.h
module/zfs/dbuf_stats.c
module/zfs/dmu_object.c
module/zfs/dnode.c
tests/runfiles/linux.run
tests/zfs-tests/tests/functional/features/large_dnode/Makefile.am
tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_008_pos.ksh
tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_009_pos.ksh [new file with mode: 0755]