]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r305340: MFC r305337:
authormav <mav@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Fri, 14 Oct 2016 07:40:20 +0000 (07:40 +0000)
committermav <mav@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Fri, 14 Oct 2016 07:40:20 +0000 (07:40 +0000)
commit1df94f4b58ce4bbc328b955971b542b4a6ec7f8a
tree0cf07e3b365925875e4014646fffa08b9893cd13
parent01dc5cb1977a7a112b3638c7dcbbbef90e9c1dbd
MFC r305340: MFC r305337:
7004 dmu_tx_hold_zap() does dnode_hold() 7x on same object

Using a benchmark which has 32 threads creating 2 million files in the
same directory, on a machine with 16 CPU cores, I observed poor
performance. I noticed that dmu_tx_hold_zap() was using about 30% of
all CPU, and doing dnode_hold() 7 times on the same object (the ZAP
object that is being held).

dmu_tx_hold_zap() keeps a hold on the dnode_t the entire time it is
running, in dmu_tx_hold_t:txh_dnode, so it would be nice to use the
dnode_t that we already have in hand, rather than repeatedly calling
dnode_hold(). To do this, we need to pass the dnode_t down through
all the intermediate calls that dmu_tx_hold_zap() makes, making these
routines take the dnode_t* rather than an objset_t* and a uint64_t
object number. In particular, the following routines will need to have
analogous *_by_dnode() variants created:

dmu_buf_hold_noread()
dmu_buf_hold()
zap_lookup()
zap_lookup_norm()
zap_count_write()
zap_lockdir()
zap_count_write()

This can improve performance on the benchmark described above by 100%,
from 30,000 file creations per second to 60,000. (This improvement is on
top of that provided by working around the object allocation issue. Peak
performance of ~90,000 creations per second was observed with 8 CPUs;
adding CPUs past that decreased performance due to lock contention.) The
CPU used by dmu_tx_hold_zap() was reduced by 88%, from 340 CPU-seconds
to 40 CPU-seconds.

Sponsored by: Intel Corp.

Closes #109

Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Ned Bass <bass6@llnl.gov>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Author: Matthew Ahrens <mahrens@delphix.com>

openzfs/openzfs@d3e523d489a169ab36f9ec1b2a111a60a5563a9f

git-svn-id: svn://svn.freebsd.org/base/stable/10@307292 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c