mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
More aggsum optimizations
- Avoid atomic_add() when updating as_lower_bound/as_upper_bound. Previous code was excessively strong on 64bit systems while not strong enough on 32bit ones. Instead introduce and use real atomic_load() and atomic_store() operations, just an assignments on 64bit machines, but using proper atomics on 32bit ones to avoid torn reads/writes. - Reduce number of buckets on large systems. Extra buckets not as much improve add speed, as hurt reads. Unlike wmsum for aggsum reads are still important. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored-By: iXsystems, Inc. Closes #12145
This commit is contained in:
committed by
Brian Behlendorf
parent
b05ae1a82a
commit
e76373de7b
@@ -48,6 +48,8 @@
|
||||
#define atomic_sub_32_nv(v, i) atomic_sub_return((i), (atomic_t *)(v))
|
||||
#define atomic_cas_32(v, x, y) atomic_cmpxchg((atomic_t *)(v), x, y)
|
||||
#define atomic_swap_32(v, x) atomic_xchg((atomic_t *)(v), x)
|
||||
#define atomic_load_32(v) atomic_read((atomic_t *)(v))
|
||||
#define atomic_store_32(v, x) atomic_set((atomic_t *)(v), x)
|
||||
#define atomic_inc_64(v) atomic64_inc((atomic64_t *)(v))
|
||||
#define atomic_dec_64(v) atomic64_dec((atomic64_t *)(v))
|
||||
#define atomic_add_64(v, i) atomic64_add((i), (atomic64_t *)(v))
|
||||
@@ -58,6 +60,8 @@
|
||||
#define atomic_sub_64_nv(v, i) atomic64_sub_return((i), (atomic64_t *)(v))
|
||||
#define atomic_cas_64(v, x, y) atomic64_cmpxchg((atomic64_t *)(v), x, y)
|
||||
#define atomic_swap_64(v, x) atomic64_xchg((atomic64_t *)(v), x)
|
||||
#define atomic_load_64(v) atomic64_read((atomic64_t *)(v))
|
||||
#define atomic_store_64(v, x) atomic64_set((atomic64_t *)(v), x)
|
||||
|
||||
#ifdef _LP64
|
||||
static __inline__ void *
|
||||
|
||||
@@ -39,15 +39,16 @@ struct aggsum_bucket {
|
||||
typedef struct aggsum {
|
||||
kmutex_t as_lock;
|
||||
int64_t as_lower_bound;
|
||||
int64_t as_upper_bound;
|
||||
uint64_t as_upper_bound;
|
||||
aggsum_bucket_t *as_buckets ____cacheline_aligned;
|
||||
uint_t as_numbuckets;
|
||||
aggsum_bucket_t *as_buckets;
|
||||
uint_t as_bucketshift;
|
||||
} aggsum_t;
|
||||
|
||||
void aggsum_init(aggsum_t *, uint64_t);
|
||||
void aggsum_fini(aggsum_t *);
|
||||
int64_t aggsum_lower_bound(aggsum_t *);
|
||||
int64_t aggsum_upper_bound(aggsum_t *);
|
||||
uint64_t aggsum_upper_bound(aggsum_t *);
|
||||
int aggsum_compare(aggsum_t *, uint64_t);
|
||||
uint64_t aggsum_value(aggsum_t *);
|
||||
void aggsum_add(aggsum_t *, int64_t);
|
||||
|
||||
Reference in New Issue
Block a user