summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/time_stats.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-02-08 18:33:35 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-03-13 21:37:58 -0400
commit4b4f0876ab74167cc402ccd5ce9154e7dc666829 (patch)
tree17274b58e78f71a8763cf1e035022a32b19be6f9 /fs/bcachefs/time_stats.h
parentcdbfa228a5537dfd7cbd8532701b0c8af70c97b8 (diff)
downloadlinux-4b4f0876ab74167cc402ccd5ce9154e7dc666829.tar.gz
linux-4b4f0876ab74167cc402ccd5ce9154e7dc666829.tar.bz2
linux-4b4f0876ab74167cc402ccd5ce9154e7dc666829.zip
bcachefs: mean_and_variance: put struct mean_and_variance_weighted on a diet
The only caller of this code (time_stats) always knows the weights and whether or not any information has been collected. Pass this information into the mean and variance code so that it doesn't have to store that information. This reduces the structure size from 24 to 16 bytes, which shrinks each time_stats counter to 192 bytes from 208. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/time_stats.h')
-rw-r--r--fs/bcachefs/time_stats.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/bcachefs/time_stats.h b/fs/bcachefs/time_stats.h
index d0291ea863ba..fd6e442443f9 100644
--- a/fs/bcachefs/time_stats.h
+++ b/fs/bcachefs/time_stats.h
@@ -80,8 +80,12 @@ struct bch2_time_stats {
struct quantiles quantiles;
struct mean_and_variance duration_stats;
- struct mean_and_variance_weighted duration_stats_weighted;
struct mean_and_variance freq_stats;
+
+/* default weight for weighted mean and variance calculations */
+#define TIME_STATS_MV_WEIGHT 8
+
+ struct mean_and_variance_weighted duration_stats_weighted;
struct mean_and_variance_weighted freq_stats_weighted;
struct time_stat_buffer __percpu *buffer;
};