diff options
author | Yafang Shao <laoar.shao@gmail.com> | 2017-10-10 00:44:13 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-10-09 17:27:40 +0300 |
commit | 94af584692091347baea4d810b9fc6e0f5483d42 (patch) | |
tree | 8cd6f2a226de8cb7be61cba130ed7ee2a1d9d0ed | |
parent | 4078def82f352cf5007691635da290a109511bc5 (diff) | |
download | linux-94af584692091347baea4d810b9fc6e0f5483d42.tar.xz |
writeback: schedule periodic writeback with sysctl
After disable periodic writeback by writing 0 to
dirty_writeback_centisecs, the handler wb_workfn() will not be
entered again until the dirty background limit reaches or
sync syscall is executed or no enough free memory available or
vmscan is triggered.
So the periodic writeback can't be enabled by writing a non-zero
value to dirty_writeback_centisecs.
As it can be disabled by sysctl, it should be able to enable by
sysctl as well.
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | mm/page-writeback.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 8d1fc593bce8..622a18c114ca 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -1972,8 +1972,14 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb) int dirty_writeback_centisecs_handler(struct ctl_table *table, int write, void __user *buffer, size_t *length, loff_t *ppos) { - proc_dointvec(table, write, buffer, length, ppos); - return 0; + unsigned int old_interval = dirty_writeback_interval; + int ret; + + ret = proc_dointvec(table, write, buffer, length, ppos); + if (!ret && !old_interval && dirty_writeback_interval) + wakeup_flusher_threads(WB_REASON_PERIODIC); + + return ret; } #ifdef CONFIG_BLOCK |