mirror_zfs/module
Alexander Motin e0ce98d57c
Reduce number of atomic_add() calls in aggsum
Previous code used 4 atomics to do aggsum_flush_bucket() and 2 more to
re-borrow after the flush.  But since asc_borrowed and asc_delta are
accessed only while holding asc_lock, it makes no any sense to modify
as_lower_bound and as_upper_bound in multiple steps.  Instead of that
the new code uses only 2 atomics in all the cases, one per as_*_bound
variable.  I think even that is overkill, simple atomic store and
load could be used here, since all modifications are done under the
as_lock, but there are no such primitives in ZFS code now.

While there, make borrow code consider previous borrow value, so that
on mixed request patterns reduce chance of needing to borrow again if
much larger request follows tiny one that needed borrow.

Also reduce as_numbuckets from uint64_t to u_int.  It makes no sense
to use so large division operation on every aggsum_add().

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #9930
2020-02-06 13:21:06 -08:00
..
avl Wrap Linux module macros 2019-11-01 10:41:03 -07:00
icp Unify target_cpu handling 2020-01-17 12:40:09 -08:00
lua cppcheck: (error) Address of local auto-variable assigned 2019-12-18 17:25:42 -08:00
nvpair cppcheck: (warning) Possible null pointer dereference: nvh 2019-12-18 17:25:57 -08:00
os Replace static per-cpu with dynamic per-cpu data 2020-02-06 09:26:13 -08:00
spl OpenZFS restructuring - move platform specific sources 2019-09-06 11:26:26 -07:00
unicode Wrap Linux module macros 2019-11-01 10:41:03 -07:00
zcommon Restore aclmode and remove acltype on FreeBSD 2020-02-04 08:40:07 -08:00
zfs Reduce number of atomic_add() calls in aggsum 2020-02-06 13:21:06 -08:00
.gitignore Adapt gitignore for modules 2019-12-02 13:23:47 -08:00
Makefile.in module/Makefile.in: don't run xargs if empty 2019-10-08 10:10:23 -07:00