diff options
author | Alexander Motin <[email protected]> | 2020-02-06 16:21:06 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-06 13:21:06 -0800 |
commit | e0ce98d57c44b324ffa99f0620ef8721814fc43e (patch) | |
tree | d4c2759dd507d4d5bce8b0da685edb38121fa111 /include/sys/aggsum.h | |
parent | 77122f9d68a3a6e3fbd266652467acbd7b5d3225 (diff) |
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 <[email protected]>
Reviewed-by: Paul Dagnelie <[email protected]>
Signed-off-by: Alexander Motin <[email protected]>
Sponsored-By: iXsystems, Inc.
Closes #9930
Diffstat (limited to 'include/sys/aggsum.h')
-rw-r--r-- | include/sys/aggsum.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/sys/aggsum.h b/include/sys/aggsum.h index caa08d773..cb43727f1 100644 --- a/include/sys/aggsum.h +++ b/include/sys/aggsum.h @@ -40,7 +40,7 @@ typedef struct aggsum { kmutex_t as_lock; int64_t as_lower_bound; int64_t as_upper_bound; - uint64_t as_numbuckets; + uint_t as_numbuckets; aggsum_bucket_t *as_buckets; } aggsum_t; |