diff options
author | Matthew Ahrens <[email protected]> | 2016-07-20 22:50:26 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-08-16 15:27:17 -0700 |
commit | d9eea113f8b8988a8ec4f9c73b717c7311322348 (patch) | |
tree | 6657cf547fb9cc44626433d319b7f550997aa8a4 /module/zfs/dsl_deleg.c | |
parent | f0c26069bdf4ec675c840f0932fcfe7d4036d06f (diff) |
It is not necessary to zero struct dbuf_hold_impl_data
Under a workload which makes heavy use of `dbuf_hold()`, I noticed that a
considerable amount of time was spent in `dbuf_hold_impl()`, due to its call to
`kmem_zalloc(sizeof (struct dbuf_hold_impl_data) * DBUF_HOLD_IMPL_MAX_DEPTH)`,
which is around 2KiB. This structure is used as a stack, to limit the size of
the C stack as dbuf_hold() calls itself recursively. We make a recursive call
to hold the parent's dbuf when the requested dbuf is not found. The vast
majority of the time, the parent or grandparent indirect dbuf is cached, so the
number of recursive calls is very low. However, we initialize this entire
array for every call to dbuf_hold().
To improve performance, this commit changes `dbuf_hold()` to use `kmem_alloc()`
instead of `kmem_zalloc()`. __dbuf_hold_impl_init is changed to initialize all
members of the struct before they are used. I observed ~5% performance
improvement on a workload which creates many files.
Signed-off-by: Matthew Ahrens <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #4974
Diffstat (limited to 'module/zfs/dsl_deleg.c')
0 files changed, 0 insertions, 0 deletions