linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page-writeback.c: fix bug caused by disable periodic writeback
@ 2017-10-06 22:58 Yafang Shao
  2017-10-09  9:56 ` Jan Kara
  2017-10-09 22:42 ` Andrew Morton
  0 siblings, 2 replies; 12+ messages in thread
From: Yafang Shao @ 2017-10-06 22:58 UTC (permalink / raw)
  To: akpm, jack, mhocko, hannes, vdavydov.dev, jlayton, nborisov,
	tytso, mawilcox
  Cc: linux-mm, linux-kernel, laoar.shao

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.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
 mm/page-writeback.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 0b9c5cb..e202f37 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1972,7 +1972,13 @@ 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);
+	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(0, WB_REASON_PERIODIC);
+
 	return 0;
 }
 
-- 
1.8.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 12+ messages in thread
* Re: [PATCH] mm/page-writeback.c: fix bug caused by disable periodic writeback
@ 2017-10-09 10:44 Yafang Shao
  2017-10-09 11:03 ` Jan Kara
  0 siblings, 1 reply; 12+ messages in thread
From: Yafang Shao @ 2017-10-09 10:44 UTC (permalink / raw)
  To: Jan Kara
  Cc: Andrew Morton, mhocko, Johannes Weiner, vdavydov.dev, jlayton,
	nborisov, Theodore Ts'o, mawilcox, linux-mm, linux-kernel,
	axboe

2017-10-09 17:56 GMT+08:00 Jan Kara <jack@suse.cz>:
> On Sat 07-10-17 06:58:04, Yafang Shao wrote:
>> 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.
>>
>> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
>> ---
>>  mm/page-writeback.c | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
>> index 0b9c5cb..e202f37 100644
>> --- a/mm/page-writeback.c
>> +++ b/mm/page-writeback.c
>> @@ -1972,7 +1972,13 @@ 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);
>> +     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(0, WB_REASON_PERIODIC);
>> +
>
> I agree it is good to schedule some writeback. However Jens has some
> changes queued in linux-block tree in this area so your change won't apply.
> So please base your changes on his tree.
>

Do you mean this tree
git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git ?

I have checked his tree and find nothing need to change on my patch.

>                                                                 Honza
> --
> Jan Kara <jack@suse.com>
> SUSE Labs, CR

Thanks
Yafang

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-10-11  4:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-06 22:58 [PATCH] mm/page-writeback.c: fix bug caused by disable periodic writeback Yafang Shao
2017-10-09  9:56 ` Jan Kara
2017-10-09 22:42 ` Andrew Morton
2017-10-10  8:00   ` Yafang Shao
2017-10-10  8:48     ` Jan Kara
2017-10-10  9:14       ` Yafang Shao
2017-10-10  9:33         ` Jan Kara
2017-10-11  4:06           ` Yafang Shao
2017-10-10  8:45   ` Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2017-10-09 10:44 Yafang Shao
2017-10-09 11:03 ` Jan Kara
2017-10-09 11:36   ` Yafang Shao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).