This is a note to let you know that I've just added the patch titled bcachefs: time_stats: Check for last_event == 0 when updating freq stats to the 6.7-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: bcachefs-time_stats-check-for-last_event-0-when-updating-freq-stats.patch and it can be found in the queue-6.7 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 7b508b323b2ec45be59769bd4e4aeba729c52cf6 Mon Sep 17 00:00:00 2001 From: Kent Overstreet <kent.overstreet@xxxxxxxxx> Date: Thu, 1 Feb 2024 21:01:02 -0500 Subject: bcachefs: time_stats: Check for last_event == 0 when updating freq stats From: Kent Overstreet <kent.overstreet@xxxxxxxxx> commit 7b508b323b2ec45be59769bd4e4aeba729c52cf6 upstream. This fixes spurious outliers in the frequency stats. Signed-off-by: Kent Overstreet <kent.overstreet@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/bcachefs/util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/fs/bcachefs/util.c +++ b/fs/bcachefs/util.c @@ -362,14 +362,15 @@ static inline void bch2_time_stats_updat bch2_quantiles_update(&stats->quantiles, duration); } - if (time_after64(end, stats->last_event)) { + if (stats->last_event && time_after64(end, stats->last_event)) { freq = end - stats->last_event; mean_and_variance_update(&stats->freq_stats, freq); mean_and_variance_weighted_update(&stats->freq_stats_weighted, freq); stats->max_freq = max(stats->max_freq, freq); stats->min_freq = min(stats->min_freq, freq); - stats->last_event = end; } + + stats->last_event = end; } static noinline void bch2_time_stats_clear_buffer(struct bch2_time_stats *stats, Patches currently in stable-queue which might be from kent.overstreet@xxxxxxxxx are queue-6.7/bcachefs-don-t-pass-memcmp-as-a-pointer.patch queue-6.7/bcachefs-kvfree-bch_fs-snapshots-in-bch2_fs_snapshots_exit.patch queue-6.7/bcachefs-grab-s_umount-only-if-snapshotting.patch queue-6.7/bcachefs-time_stats-check-for-last_event-0-when-updating-freq-stats.patch queue-6.7/bcachefs-fix-incorrect-usage-of-req_op_flush.patch queue-6.7/bcachefs-add-missing-bch2_moving_ctxt_flush_all.patch queue-6.7/bcachefs-unlock-parent-dir-if-entry-is-not-found-in-subvolume-deletion.patch queue-6.7/bcachefs-rebalance-should-wakeup-on-shutdown-if-disabled.patch queue-6.7/bcachefs-bch2_kthread_io_clock_wait-no-longer-sleeps-until-full-amount.patch