All of lore.kernel.org
 help / color / mirror / Atom feed
* [folded-merged] writeback-fix-bandwidth-estimate-for-spiky-workload-fix.patch removed from -mm tree
@ 2021-09-02 21:12 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2021-09-02 21:12 UTC (permalink / raw)
  To: fengguang.wu, jack, mm-commits, stapelberg+linux


The patch titled
     Subject: writeback: avoid division by 0 in wb_update_dirty_ratelimit()
has been removed from the -mm tree.  Its filename was
     writeback-fix-bandwidth-estimate-for-spiky-workload-fix.patch

This patch was dropped because it was folded into writeback-fix-bandwidth-estimate-for-spiky-workload.patch

------------------------------------------------------
From: Jan Kara <jack@suse.cz>
Subject: writeback: avoid division by 0 in wb_update_dirty_ratelimit()

Fixup patch "writeback: Fix bandwidth estimate for spiky workload" which
introduced possibility of __wb_update_bandwidth() getting called at a
moment when 'elapsed' evaluates to 0.

Cc: Jan Kara <jack@suse.cz>
Cc: Michael Stapelberg <stapelberg+linux@google.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/page-writeback.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/mm/page-writeback.c~writeback-fix-bandwidth-estimate-for-spiky-workload-fix
+++ a/mm/page-writeback.c
@@ -1336,11 +1336,19 @@ static void __wb_update_bandwidth(struct
 {
 	struct bdi_writeback *wb = gdtc->wb;
 	unsigned long now = jiffies;
-	unsigned long elapsed = now - wb->bw_time_stamp;
+	unsigned long elapsed;
 	unsigned long dirtied;
 	unsigned long written;
 
 	spin_lock(&wb->list_lock);
+
+	/*
+	 * Lockless checks for elapsed time are racy and delayed update after
+	 * IO completion doesn't do it at all (to make sure written pages are
+	 * accounted reasonably quickly). Make sure elapsed >= 1 to avoid
+	 * division errors.
+	 */
+	elapsed = max(now - wb->bw_time_stamp, 1UL);
 	dirtied = percpu_counter_read(&wb->stat[WB_DIRTIED]);
 	written = percpu_counter_read(&wb->stat[WB_WRITTEN]);
 
_

Patches currently in -mm which might be from jack@suse.cz are

writeback-track-number-of-inodes-under-writeback.patch
writeback-reliably-update-bandwidth-estimation.patch
writeback-fix-bandwidth-estimate-for-spiky-workload.patch
writeback-rename-domain_update_bandwidth.patch
writeback-use-read_once-for-unlocked-reads-of-writeback-stats.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-02 21:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-02 21:12 [folded-merged] writeback-fix-bandwidth-estimate-for-spiky-workload-fix.patch removed from -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.