Files
mirror_zfs/module/zfs
Matthew Ahrens 2bce8049c3 OpenZFS 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.

Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>

OpenZFS-issue: https://www.illumos.org/issues/7004
OpenZFS-commit: https://github.com/openzfs/openzfs/pull/109
Closes #4641
Closes #4972
2016-08-19 12:48:03 -07:00
..
2014-08-01 14:28:05 -07:00
2015-01-16 14:41:26 -08:00
2016-01-08 15:08:19 -08:00
2016-01-08 20:23:23 -05:00
2015-01-16 14:41:26 -08:00
2016-01-08 15:08:19 -08:00
2016-08-16 14:11:55 -07:00
2016-06-28 13:47:02 -07:00
2016-08-11 11:23:49 -07:00
2013-12-18 16:46:35 -08:00
2015-01-16 14:41:26 -08:00
2015-01-16 14:41:26 -08:00
2016-08-02 13:14:18 -07:00
2015-12-22 10:21:33 -08:00
2016-04-21 09:49:25 -07:00
2016-06-21 09:58:37 -07:00
2015-01-16 14:41:26 -08:00
2016-06-24 13:13:21 -07:00
2010-08-31 13:41:59 -07:00
2010-08-31 13:41:58 -07:00
2016-08-11 11:23:49 -07:00
2016-06-24 13:13:21 -07:00
2016-01-08 15:08:19 -08:00
2015-01-16 14:41:26 -08:00
2015-01-16 14:41:26 -08:00
2016-07-19 16:43:07 -07:00
2013-10-31 14:58:04 -07:00
2016-08-12 13:46:51 -07:00
2010-08-31 13:41:58 -07:00
2016-07-25 13:21:49 -07:00
2015-09-04 16:08:14 -07:00
2016-07-25 13:21:49 -07:00
2016-07-25 13:21:49 -07:00
2016-07-25 13:21:49 -07:00
2016-05-17 10:29:02 -07:00
2016-07-25 13:21:49 -07:00
2016-07-29 15:34:12 -07:00
2014-08-01 14:28:05 -07:00
2016-07-27 13:38:46 -07:00
2016-05-31 16:04:26 -07:00