Use wmsum for arc, abd, dbuf and zfetch statistics. (#12172)

wmsum was designed exactly for cases like these with many updates
and rare reads.  It allows to completely avoid atomic operations on
congested global variables.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored-By: iXsystems, Inc.
Closes #12172
This commit is contained in:
Alexander Motin
2021-06-16 20:19:34 -04:00
committed by GitHub
parent 9ffcaa370a
commit c4c162c1e8
8 changed files with 777 additions and 215 deletions
+2 -2
View File
@@ -27,6 +27,7 @@
#define _ABD_IMPL_H
#include <sys/abd.h>
#include <sys/wmsum.h>
#ifdef __cplusplus
extern "C" {
@@ -82,9 +83,8 @@ void abd_iter_unmap(struct abd_iter *);
/*
* Helper macros
*/
#define ABDSTAT(stat) (abd_stats.stat.value.ui64)
#define ABDSTAT_INCR(stat, val) \
atomic_add_64(&abd_stats.stat.value.ui64, (val))
wmsum_add(&abd_sums.stat, (val))
#define ABDSTAT_BUMP(stat) ABDSTAT_INCR(stat, 1)
#define ABDSTAT_BUMPDOWN(stat) ABDSTAT_INCR(stat, -1)