Skip to content

Commit

Permalink
mm/page-writeback.c: make changes of dirty_writeback_centisecs take e…
Browse files Browse the repository at this point in the history
…ffect 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>
  • Loading branch information
Yafang Shao authored and Jens Axboe committed Oct 14, 2017
1 parent fc18631 commit 515c24c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion mm/page-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 515c24c

Please sign in to comment.