aboutsummaryrefslogtreecommitdiff
path: root/mm/page-writeback.c
diff options
context:
space:
mode:
authorJan Engelmohr <jan.engelmohr@mailbox.tu-dresden.de>2016-07-26 18:11:29 +0200
committerMoyster <oysterized@gmail.com>2016-08-26 16:00:22 +0200
commitd668de80d065e7796d2fb31cf2c66084850baa2f (patch)
treee44b4f602ca66eddfd3f884618501fb473214a0b /mm/page-writeback.c
parent42fb8800204306978c6fb8f99ef68b8c1e895fd2 (diff)
3.10.74 -> 3.10.75
Diffstat (limited to 'mm/page-writeback.c')
-rw-r--r--mm/page-writeback.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 8774051a2..a4e02d873 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -812,8 +812,11 @@ static void bdi_update_write_bandwidth(struct backing_dev_info *bdi,
* bw * elapsed + write_bandwidth * (period - elapsed)
* write_bandwidth = ---------------------------------------------------
* period
+ *
+ * @written may have decreased due to account_page_redirty().
+ * Avoid underflowing @bw calculation.
*/
- bw = written - bdi->written_stamp;
+ bw = written - min(written, bdi->written_stamp);
bw *= HZ;
if (unlikely(elapsed > period)) {
do_div(bw, elapsed);
@@ -877,7 +880,7 @@ static void global_update_bandwidth(unsigned long thresh,
unsigned long now)
{
static DEFINE_SPINLOCK(dirty_lock);
- static unsigned long update_time;
+ static unsigned long update_time = INITIAL_JIFFIES;
/*
* check locklessly first to optimize away locking for the most time