summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorYafang Shao <laoar.shao@gmail.com>2017-10-14 11:38:27 +0300
committerJens Axboe <axboe@kernel.dk>2017-10-14 18:14:35 +0300
commit515c24c13c7ff1262cdb40fe631c6391e99c0996 (patch)
tree0f466f8dda1f02b4d752e5c7362829a74b56a9c2 /mm
parentfc186311f2233bb3f69f22b96babdf16a57c88a9 (diff)
downloadlinux-515c24c13c7ff1262cdb40fe631c6391e99c0996.tar.xz
mm/page-writeback.c: make changes of dirty_writeback_centisecs take effect immediately
This patch is the followup of the prvious patch: [writeback: schedule periodic writeback with sysctl]. There's another issue to fix. For example, - When the tunable was set to one hour and is reset to one second, the new setting will not take effect for up to one hour. Kicking the flusher threads immediately fixes it. Cc: Jens Axboe <axboe@kernel.dk> Cc: Jan Kara <jack@suse.cz> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Yafang Shao <laoar.shao@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'mm')
-rw-r--r--mm/page-writeback.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 622a18c114ca..c518c845f202 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1976,7 +1976,16 @@ int dirty_writeback_centisecs_handler(struct ctl_table *table, int write,
int ret;
ret = proc_dointvec(table, write, buffer, length, ppos);
- if (!ret && !old_interval && dirty_writeback_interval)
+
+ /*
+ * Writing 0 to dirty_writeback_interval will disable periodic writeback
+ * and a different non-zero value will wakeup the writeback threads.
+ * wb_wakeup_delayed() would be more appropriate, but it's a pain to
+ * iterate over all bdis and wbs.
+ * The reason we do this is to make the change take effect immediately.
+ */
+ if (!ret && write && dirty_writeback_interval &&
+ dirty_writeback_interval != old_interval)
wakeup_flusher_threads(WB_REASON_PERIODIC);
return ret;